You need to sign in to do that
Don't have an account?

Unable to push to or even list scratch org: "invalid_grant - expired access/refresh token"
I've been unable to push to my scratch org or even list it in gitbash / CLI since yesterday. Looks like my token has expired but after a half day of Googling I can't find a solution for how to fix it when the issue is your gitbash won't connect (all I'm finding is how to fix the code in your APIs getting the similar messages).
I'm able to log in to my scratch org through the browser, but if I try to force:auth:web:login and pop the URL that way, I get an error about localhost. Below is what I'm getting in gitbash:
sfdx force:org:push -u -sfdx-tst
ERROR running force:source:push: Error authenticating with the refresh token due to: expired access/refresh token
sfdx force:org:display
ERROR running force:org:display: This org appears to have a problem with its OAuth configuration. Reason: invalid_grant - expired access/refresh token
username: test-ealg1mxwqs9w@example.com,
clientId: PlatformCLI,
loginUrl: https://CS69.salesforce.com,
privateKey: <Not Specified>
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.
Even if the connected app tried and failed to access your information because it could not log in, the Use Count and Last Used fields are still updated.
For more information with a similar discussion please check the below thread from the stack exchange community which might give you a better understanding.
http://salesforce.stackexchange.com/questions/65590/what-causes-a-connected-apps-refresh-token-to-expire
For further reference, you can check this blog too (https://salesforce.stackexchange.com/questions/10759/invalid-grant-expired-access-refresh-token-error-when-authenticating-access-via).
I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.
Thanks.
I'm able to log in to the scratchorg via the browser. For some reason after one week, gitbash / CLI no longer have an active authorization and I don't know how to renew it.
Please log a case with salesforce support so that they will check their internal logs and assist you.
One of the other guys in my org came up with the answer, couldn't find this on Google no matter how hard I tried. Posting here in case anyone finds this article & has the same issue with reauthorizing your token for a scratch org:
From within VSCode, hit CTRL + SHIFT + P and select "Authorize an Org," or from gitbash or CLI run sfdx force:auth:web:login -r https://test.salesforce.com and login with your scratch org's creds
Greetings!
This error occurs when your access token is expired.
So please install the latest version of salesforce CLI.
Then try to re-authorize your org.
It will generate a new access token for your scratch org.
So you can access your scratch org in VS Code as well.
If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi
I followed the above steps but they didn't work, initially, one step was missing. Restarting VS Code