Hello,
i’m getting this error { errors: [ { id: 'invalid_token', message: 'The access token is invalid' } ] }
each time i’m trying to send request to POST https://api.coinbase.com/v2/accounts/:account_id/transaction
with as auth method API KEY
sample code that i’m using
const timestamp = Math.floor(Date.now() / 1000);
const data = {
"type": "send",
"to": 'mail@gmail.com',
"amount": "1",
"currency": "USDT",
"description": "For being awesome!"
}
const req = {
method: 'POST',
path: '/v2/accounts/ACCOUNT_ID/transactions',
body: JSON.stringify(data)
}
var message = timestamp + 'POST' + req.path + JSON.stringify(data);
const signature = crypto.createHmac('sha256', process.env.COINBASE_API_SECRET).update(message).digest('hex');
const headers = {
'CB-ACCESS-KEY': process.env.COINBASE_API_KEY,
'CB-ACCESS-SIGN': signature,
'CB-ACCESS-TIMESTAMP': timestamp,
'CB-VERSION': '2023-05-22'
}