[SalesForce] invalid_grant-expired access/refresh token error when authenticating access via REST

I'm facing a strange scenario – I'm using a REST Client to authenticate access to SF.
I'm using "grant_type": "password" the client key, client secret, username and password concatenated with the token.
my request URL is: https://cs17.salesforce.com/services/oauth2/token

I checked the parameters and they are correct

I don't have a clue why but I'm getting this error:

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

In the past it worked fine and now I don't know what went wrong.

Best Answer

Are you setting the client_id and secret ?

Those are the parameters you should send:

client_id=XXXXXX
&client_secret=XXXX
&password=passTOKEN
&username=XXX
&grant_type=password

Ensure you are setting the header Content-Type: application/x-www-form-urlencoded.

BTW, user-password flow doesn't support refresh_token flow. More info see this reply

Related Topic