Search code examples
salesforceoauth-2.0access-token

How to refresh access_token in OAuth 2.0 in salesforce


I am developing a salesforce app and using OAuth 2.0 to login. I have a refresh token; how do I get a new access_token by sending a request to salesforce via OAuth 2.0 containing the refresh token for a particular user?


Solution

  • Taken from "Digging Deeper into Oauth 2.0 on Force.com", your application can obtain a new access token by POSTing another request to: https://login.salesforce.com/services/oauth2/token. The payload should be of the form: grant_type=refresh_token&client_id=[your client id]&client_secret=[your client secret]&refresh_token=[the user's refresh token].