[SalesForce] Cannot create scratch orgs in visual studio

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

Best Answer

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.

Related Topic