function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Carl PierreCarl Pierre 

Refresk token: cannot resfresh token

Hi,

I found this URL that shows how refresh token. However, it does not work for me
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_refresh_token_oauth.htm

I have this message error: 
Resfresh token error message
There are my request entries:
endpoint: https://test.salesforce.com/services/oauth2/token
grant_type: refresh_token,
client_id :
CLIENT_ID,
client_secret: CLIENT_SECRET,
 refresh_token: my_last_token,
 format :
 json


 
Best Answer chosen by Carl Pierre
Ansh CoderAnsh Coder
During the authentication,
you exchanged code with accesstoken and refresh token
see fifth point on the following page  https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm

you should use refresh token instead of the expired token that was recieved along with the access token.

 

All Answers

Ansh CoderAnsh Coder
Hi,
when you first request for an access token, you are provided with an access token and a refresh token.
use the following scenario:
endpoint: https://test.salesforce.com/services/oauth2/token
grant_type: refresh_token,
client_id : <PUT_YOUR_CLIENT_ID_HERE>,
client_secret: <PUT_YOUR_CLIENT_SECRET_HERE>,
 refresh_token: <PUT_YOUR_REFRESH_TOKEN_HERE>,
 format : json

Here grant-type should contain text: 'refresh_token'
in refresh token, value should be the actual refresh token not the last access token
Carl PierreCarl Pierre
Yes Thats what I have. by last token I my mean the actual expired token.

but still not working form me
Ansh CoderAnsh Coder
During the authentication,
you exchanged code with accesstoken and refresh token
see fifth point on the following page  https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_understanding_web_server_oauth_flow.htm

you should use refresh token instead of the expired token that was recieved along with the access token.

 
This was selected as the best answer
Carl PierreCarl Pierre
wow thank you!!