[SalesForce] Reason: invalid_grant – expired access/refresh token

I think my access token for my scratch org expired. I'm using sfdx in visual studio code. What's the easiest way to get/fresh my access token?

Best Answer

If reauthorizing doesn't help for some reasons(as I was facing) try deleting the alias as follows. It should definitely work

Step 1. Go to /home/.sfdx (In windows c:\user\.sfdx)

Step 2. Delete org specific json file(ORG_USERNAME.json).

Step 3. Edit alias.json file and remove the alias.

Step 4. Restart VS Code and reauthorize.