Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No refresh_token in SalesForce OAuth Response

I'm interacting with a custom APEX service which obviously require OAuth authentication. I can easily authenticate and authorise 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 receieve 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!..

like image 737
Mike Borozdin Avatar asked Jun 13 '12 22:06

Mike Borozdin


2 Answers

Please check Selected OAuth Scopes section, which is needed to be enabled Perform requests on your behalf at any time in order to get the refresh token.

Сreate > Apps > API (Enable OAuth Settings) > Selected OAuth Scopes.

like image 85
vasanth vasu Avatar answered Oct 22 '22 13:10

vasanth vasu


I've solved the problem thanks to my wonderful colleague.

I should have added 'refresh_token' to the scope when retrieiving an auth code.

like image 34
Mike Borozdin Avatar answered Oct 22 '22 13:10

Mike Borozdin