Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Salesforce by (11.9k points)

I'm interacting with a custom APEX service which obviously requires OAuth authentication. I can easily authenticate and authorize my application. Everything works fine.

However, the access token I receive tends to expire.

Of course, I can refresh it by sending a refresh_token. Sounds great.

The problem is I don't receive a refresh_token in a response from SalesForce.

I do send requests to [instance].salesforce.com/services/oauth2/token, I also tried to using login.salesforce.com/services/oauth2/token, but I cannot find 'refresh_token' in the response. There's everything apart from it there!

1 Answer

0 votes
by (32.1k points)
edited by

To solve this, you could try by adding 'refresh_token' to the scope when retrieving an auth code.

Or

Check Selected OAuth Scopes section which is required to be enabled in order to perform requests on your behalf at any time in order to get the refresh token.

Are you interested in learning Salesforce from the basics! Refer to this video on Salesforce provided by Intellipaat:

Create > Apps > API (Enable OAuth Settings) > Selected OAuth Scopes

Browse Categories

...