I am trying to create a scratch orgs from visual studio, I authorise the dev hub successfully but when I try to create a scratch org it throw this error :

ERROR: Error authenticating with the refresh token due to: expired access/refresh token.

I tried with 3-4 dev hub orgs, all the dev hub org authorised successfully, but cant able to create scratch orgs. Please advise

  • Did you install the Salesforce DX pre-release version? Can you show us what version you are on and the output of sfdx force:org:list?
    – David Reed
    Dec 25, 2018 at 12:31
  • Hi David, I updated to the latest version. still same. sfdx-cli: Updating CLI... already on latest version: 6.44.0-dead729fb5 sfdx-cli: Updating plugins... done
    – Tariq
    Dec 26, 2018 at 5:31
  • sfdx-cli/6.44.0-dead729fb5 (darwin-x64) node-v8.9.4 this is my version of cli
    – Tariq
    Dec 26, 2018 at 5:39

1 Answer 1


Run command %USERPROFILE%\.sfdx in windows. This will open folder which is host of .json files. All connected orgs .json files will be here.

Inside the file, has the hashes for current access token, refresh token, and all the other OAuth goodness that allows DX to access your org. So simply deleted that file using command:

rm dhanik.sahni@lwc.com.json

That appears to have cleaned it all up, and I'm no longer bothered by the "invalid grant" message and the shadow org.

After this done try to create scratch org.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.