1

I am getting the access_token using Username-Password OAuth Authentication Flow.

When I create the connected app in Salesforce to get the client Id and consumer Key I set Refresh Token Policy to Refresh token is valid until revoked.

At this time everything is OK but some hours later I get this error when I tried to access to my webservice 'Session Id is invalid'.

Why is invalid If I have used this Refresh Token Policy???

2

Access tokens always work for hours only.

When the access token expires, you need to get new Access token by using the Refresh token. Here the validity of refresh token come in place. If it is set to "Refresh token is valid until revoked", you can get access token as long as refresh token is invalidated by user.

Refresh token is valid until revoked does not apply on received Access Token.

Note: Username-Password OAuth Authentication Flow does not return refrsh token. It only return access token. You would use Web flow to get Refresh token with Access token.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.