You need to sign in to do that
Don't have an account?
Owen Millard
Just-issued refresh_token fails with "expired access/refresh token"
I'm trying to access the API of a sandbox instance using OAuth.
1. I redirect the user to test.salesforce.com
2. The user confirms access and is redirected back to me
3. I exchange the code for a refreshToken
4. I immediately exchange the refresh_token for a new access_token using this command:
curl -X POST --data 'refresh_token=[refresh token form step 3]&client_id=[my client id]&client_secret=[my client secret]&grant_type=refresh_token' -H 'Accept: application/json' -H 'Sforce-Call-Options: client=fivetran' -H 'Content-Type: application/x-www-form-urlencoded' 'https://test.salesforce.com/services/oauth2/token'
Salesforce replies:
{"error":"invalid_grant","error_description":"expired access/refresh token"}
How can the token be expired? It was just issued. I have also used this exact same application logic to connect to production salesforce instances successfully (with a different application configuration, and using login.salesforce.com instead of test.salesforce.com).
1. I redirect the user to test.salesforce.com
2. The user confirms access and is redirected back to me
3. I exchange the code for a refreshToken
4. I immediately exchange the refresh_token for a new access_token using this command:
curl -X POST --data 'refresh_token=[refresh token form step 3]&client_id=[my client id]&client_secret=[my client secret]&grant_type=refresh_token' -H 'Accept: application/json' -H 'Sforce-Call-Options: client=fivetran' -H 'Content-Type: application/x-www-form-urlencoded' 'https://test.salesforce.com/services/oauth2/token'
Salesforce replies:
{"error":"invalid_grant","error_description":"expired access/refresh token"}
How can the token be expired? It was just issued. I have also used this exact same application logic to connect to production salesforce instances successfully (with a different application configuration, and using login.salesforce.com instead of test.salesforce.com).
{
"error": "invalid_grant",
"error_description": "expired access/refresh token"
}
POST /services/oauth2/token HTTP/1.1 Host: login.salesforce.com/ grant_type=refresh_token&client_id=3MVG9lKcPoNINVBIPJjdw1J9LLM82HnFVVX19KY1uA5mu0 QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA9GE&client_secret=1955279925675241571 &refresh_token=your token here