I am a newbie to Salesforce. I am planning on implementing username-password OAuth 2.0 flow in my iOS app. I am getting access_token after calling https://login.salesforce.com/services/oauth2/token
API. Is this token long lived? It seems there is no way to refresh this access_token. Can I use this in future without having to refresh it?
[SalesForce] OAuth 2.0 username-password flow: Is the access token long lived
Related Topic
- [SalesForce] OAuth 2.0 JWT Bearer Token Flow refresh_token
- [SalesForce] JWT Error – user hasn’t approved this consumer
- Unable to get oAuth access token for sandbox after making HTTP POST from postman. Access token is returned for Production environment
- Using Access Token from OAuth 2.0 Username-Password Flow to access data export page
Best Answer
You should check the operation response and handle any exception. If the response is an 401 containing this JSON:
, you could call a refresh_token flow like this :
However, you only get the refresh token from the Web server and User-Agent as is indicated here.
So, I think that after login using user-password flow, you should re-authenticate the user or change the flow.
Refresh Token
I recommend you to read this article of digging deeper into OAuth in force