I have an application which sits in Salesforce.

The application authenticates using the web browser flow, authenticating against an external API. Upon authentication, the external API returns an access token and refresh token - which we can see in the Salesforce Developer Console logs. I have also confirmed that the access/refresh token logic of the external API works through Postman calls. Furthermore, If the access token is invalid, the API returns a 401.

The Apex code of our application makes use of the AuthProviderTokenResponse and OAuthRefreshResult classes to set and refresh the tokens.

However, we are constantly having to re-authenticate despite the refresh token having a limit of 90 days.

We still have to re-authenticate even after providing the Permission Set access to User External Credentials

User External Credentials

Are there any hunches as to why I’m having to re-authenticate every couple of days despite receipt of valid access and refresh token from the external api? I'm wondering if something has not be configured correctly in the application as it is relatively new.



You must log in to answer this question.