Coinbase refresh token API endpoint not working

Hello everyone,

For several days I have been testing the endpoint to generate a new access_token from the refresh_token, it seems that this endpoint does not work, despite the multiple posts from other users on the forum reporting this problem, I cannot find any solution.

I work under Node.js, and here is my simple code which should return a new access_token :

async function refreshAccessToken(refresh_token) {
try {
const response = await axios.post(‘https://api.coinbase.com/oauth/token’, {
grant_type: ‘refresh_token’,
refresh_token: ‘refresh_token’,
client_id: ‘client_id’,
client_secret: ‘client_secret’
});

    const { access_token } = response.data;
    return access_token;
} catch (error) {
    console.error('Error refreshing access token:', error);
    throw new Error('Failed to refresh access token');
}

}

This function return :

 error: 'invalid_grant',
      error_description: 'The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.'
    }

Referring to this post :

https://forums.coinbasecloud.dev/t/oauth-invalid-grant-on-refresh-token/3987/2

it seems that the refresh token can only be used once, can someone confirm this very restrictive information ?

In certain cases, the security system of coinbase may delay a transactions for several different reason (postpone the transaction and therefore remain pending),
how can we track the status of a transaction in such a scenario ?

I have written a function to check the status of transactions and to notify if a change appears, but if the access token has expired (it expires well before the date of the transaction has been delayed), we must obtain a new access token using the refresh token, which itself seems to have a short lifespan given that it can only be exchanged once per pair of access_token/refresh_token.

Therefore, it is impossible to properly follow the status of a transaction with the Coinbase API, which is, to say the least, VERY restrictive.

My entire project is put on hold because of this improbable problem, we should be able to follow the status of a transaction without restriction, it’s crucial.

Thanks in advance for response.

No body here ???

Wow , Very powerful forum, full of help and very fast as you can see.

  • 4 days and no one responds
  • no moderation of the forum, except to let the scammers who try to steal coinbase users moderators are useless
  • the fact that the coinbase api is FULL of bugs, misunderstandings and lack of functionality , my project will take the direction of binance.com.

thank you coinShitcloud

you need to send application/x-www-form-urlencoded request now instead of JSON, the docs don’t mention this but changing the request body fixed the issue for me