You need to sign in to do that
Don't have an account?

API refresh_token ERROR (expired access/refresh token)
When trying to refresh my user token via the API i receve the below error, i am trying to test out an integration work arround for when the integration password is reset / security token expires.
{ "error": "invalid_grant", "error_description": "expired access/refresh token" }
I have tried to make the request via Curl and using Postman but receve the same error, as far as i can tell i have all of the appropiate rights set up on my connected app.
Example Curl request:
curl POST https://eu16.salesforce.com/services/oauth2/token -d "grant_type=refresh_token&client_id=3MVG9f..............................svQ10&client_secret=97E8475611A9...............................096391&refresh_token=lZI..........ZSQ"
I have redacted the sensitive infomation above, but this is the data i am entering:
client_id = This is the Consumer Key taken from the connected app screen
client_secret = This is the Consumer Secret taken from the connected app screen
refresh_token = This is the user security token (Obtained from settings -> My Personal Infomation -> Reset Security Token)
Is anyone able to detail what i am doing incorrectly?
Greetings to you!
Your app needs permissions (scope) to have the ability to use refresh tokens.
In Setup > Quick Find > App Manager >, click the "Edit" link for your Connected App and add the scope "Perform requests on your behalf at any time (refresh_token, offline_access)".
Once this has saved (you may have to wait a while), you will be able to change the value for the refresh token policy.
Reference: https://salesforce.stackexchange.com/questions/69161/refresh-token-policy-locked-to-immediatly-expire-token
Also, please refer to below links which might help you further with the above issue.
https://salesforce.stackexchange.com/questions/10759/invalid-grant-expired-access-refresh-token-error-when-authenticating-access-via
https://salesforce.stackexchange.com/questions/65590/what-causes-a-connected-apps-refresh-token-to-expire
https://salesforce.stackexchange.com/questions/73512/oauth-access-token-expiration
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
@Khan Anas - unfortunatly i allready have that scope assigned but i am still seeing the error.
Regards