I am connecting with the Salesforce API using OAuth, refresh_token, client_id & client_secret.
API calls are failing randomly with, it's not every API call but 1 in 100 or sometime in 1000 will fail with
invalid_grant: authentication failure. Below is the example of the request I am doing to salesforce.
curl -X POST \ https://login.salesforce.com/services/oauth2/token \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'grant_type=refresh_token &refresh_token=our_refresh_token &client_id=client_id &client_secret=client_secret'
The solution I tried but didn't work:-
- Creating a new refresh_token.
- Relaxing API limit for the app.
Some more information on the issue:-
- This bug started coming out of nowhere after we migrated our Salesforce instance to custom URL e.g:-
myorg.my.salesforce.com, could there be an issue because of that?