Skip to main content
I am getting below error while requesting  REST API OAuth access token using refresh token. This is happing very frequent. So I am going for authorization every time. Client feels that this so difficult at everytime to authorization.

Endpoint Url https://login.salesforce.com/services/oauth2/token

Response : 

{ "error": "invalid_grant", "error_description": "expired access/refresh token" }

Please do the needful.
1 risposta
  1. 25 mar 2020, 22:56
    Hi,

    Please check payload format and it should be in below mentioned format.

    >> curl https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=myclientid" -d "client_secret=myclientsecret" 

        -d "username=mylogin@salesforce.com" -d "password=mypassword123456"

        

    >>curl https://instance_name.salesforce.com/services/data/v20.0/ -H 'Authorization: Bearer access_token'

    https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/quickstart_oauth.htm

    Review below links which had similar issues and had fix's.

    https://salesforce.stackexchange.com/questions/69161/refresh-token-policy-locked-to-immediatly-expire-token

    https://salesforce.stackexchange.com/questions/10759/invalid-grant-expired-access-refresh-token-error-when-authenticating-access-via

    https://salesforce.stackexchange.com/questions/65590/connected-app-avoiding-a-limit-on-a-number-of-issued-tokens-token-expiration

    https://salesforce.stackexchange.com/questions/73512/oauth-access-token-expiration

    Hope above information was helpful.

    Please mark as Best Answer so that it can help others in the future.

    Thanks,

    Vinay Kumar
0/9000