From today, Suddenly, I started getting the below error in VS code whenever I am running any SFDX command:

ERROR running force:source:retrieve: This org appears to have a problem with its OAuth configuration. Reason: invalid_grant - expired access/refresh token username: clientId: PlatformCLI, loginUrl: https://test.salesforce.com/, privateKey:

Try this: Verify the OAuth configuration for this org. For JWT: Ensure the private key is correct and the cert associated with the connected app has not expired. Ensure the following OAuth scopes are configured [api, refresh_token, offline_access]. Ensure the username is assigned to a profile or perm set associated with the connected app. Ensure the connected app is configured to pre-authorize admins.

I thought of Authorizing an org again, but no luck. Also, I gone thru many blogs but still I didn't see any proper solution for this problem.

Can anyone please help in solving this error?

  • Are you login to the correct host (test.salesforce.com) when using sfdx force:auth:web:login with the -r flag? – Alba Rivas Sep 28 '20 at 9:28
  • Yea, I executed sfdx force:auth:web:login -r test.salesforce.com command for authorizing but it's been hours and it is still running. Not only with this command, any SFDX command is not working, Getting the above error . – sfdc07 Sep 28 '20 at 9:33
  • And the sfdx-project.json file has : { "packageDirectories": [ { "path": "force-app", "default": true } ], "namespace": "", "sfdcLoginUrl": "test.salesforce.com", "sourceApiVersion": "47.0" } – sfdc07 Sep 28 '20 at 9:35
  • Can you try export SFDX_AUDIENCE_URL=test.salesforce.com and then try to authorize your org . Related: salesforce.stackexchange.com/questions/252008/… – Swetha Sep 28 '20 at 9:42
  • It shouldn't be running for hours - did it get to open a browser to allow you to authenticate? – Alba Rivas Sep 28 '20 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.