Skip to content

Expired Access/Refresh Token Unable to Authenticate  #1652

Description

@PhilTerz

Summary

This happens every so often, and the only resolution has been to reinstall vscode & plugins. I am hoping to get a better solution.

All CLI commands fail (source diff, retrieve, deploy, etc) with various errors, usually about an expired token. However, using sfdx force:auth:web:login successfully still does not resolve this error.

Steps To Reproduce:

  1. I don't know how to reproduce this issue. I don't know what is causing it, nor why it sporadically pops up.

Expected result

After getting a Selected components are not available in the org or Error authenticating with the refresh token due to: expired access/refresh token, and then successfully re-authenticating using sfdx force:auth:web:login, the previously attempted CLI commands should work.

Actual result

Instead of being resolved, the expired token errors continue no matter how many times you reauthenticate.

System Information

  • Which shell/terminal are you using? zsh

{
"cliVersion": "sfdx-cli/7.160.0",
"architecture": "darwin-x64",
"nodeVersion": "node-v16.16.0",
"pluginVersions": [
"@oclif/plugin-autocomplete 0.3.0 (core)",
"@oclif/plugin-commands 1.3.0 (core)",
"@oclif/plugin-help 3.3.1 (core)",
"@oclif/plugin-not-found 1.2.6 (core)",
"@oclif/plugin-plugins 1.10.11 (core)",
"@oclif/plugin-update 1.5.0 (core)",
"@oclif/plugin-warn-if-update-available 1.7.3 (core)",
"@oclif/plugin-which 1.0.4 (core)",
"@salesforce/sfdx-diff 0.0.6",
"@salesforce/sfdx-plugin-lwc-test 1.0.0 (core)",
"alias 2.1.0 (core)",
"apex 1.1.0 (core)",
"auth 2.2.2 (core)",
"community 2.0.0 (core)",
"config 1.4.14 (core)",
"custom-metadata 2.0.0 (core)",
"data 2.0.4 (core)",
"generator 2.0.2 (core)",
"info 2.0.1 (core)",
"limits 2.0.1 (core)",
"org 2.0.3 (core)",
"salesforce-alm 54.6.2 (core)",
"schema 2.1.1 (core)",
"sfdx-cli 7.160.0 (core)",
"sfdx-git-delta 5.3.0",
"signups 1.2.0 (core)",
"source 2.0.7 (core)",
"telemetry 2.0.0 (core)",
"templates 55.0.0 (core)",
"trust 2.0.1 (core)",
"user 2.1.0 (core)"
],
"osVersion": "Darwin 21.4.0"
}

Additional information

Here is an example attempt at using diff and retrieve CLI commands, failing due to token errors or "components not in org" (they are, but it clearly can't connect), and then auth-ing and getting the same error again. Changing the org alias and authenticating again doesn't resolve the issue.

5:21:05.179 Starting SFDX: Diff File Against Org

Selected components are not available in the org
15:21:19.355 Starting SFDX: Retrieve Source from Org

Error authenticating with the refresh token due to: expired access/refresh token
Starting SFDX: Authorize an Org

15:21:59.480 sfdx force:auth:web:login --setalias XXXXX --instanceurl https://test.salesforce.com --setdefaultusername
Successfully authorized xxxxx@xxxxxxxxxx.xxx.xxxxx with org ID XXXXXXXXXX
15:22:30.365 sfdx force:auth:web:login --setalias XXXXX --instanceurl https://test.salesforce.com --setdefaultusername
ended with exit code 0

15:22:43.636 Starting SFDX: Retrieve Source from Org

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    more information requiredIssue requires more information or a response from the customerstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions