Skip to content

Access Token Issue in Production Environment #3259

@Alfystar

Description

@Alfystar

Description:
Our team encountered a problem accessing the production environment using the access token. This access is required on the release day to perform verifications from the terminal with specific profiles. The procedure we followed worked on the same day and in previous instances in all sandboxes, but not in the production org. We had to revert to using ANT for retrievals, which worked despite being discontinued for almost 2 years.

Steps to obtain access-token from UI:

  1. [Optional] Execute 'Login-As' if the token is for a different user.
  2. Go to the 'Setup' tab in the desired Org.
  3. Open the Developer console of the browser (in Chrome, use 'CTRL+SHIFT+C').
  4. Navigate to the 'Application' tab -> 'Cookies' vertical menu -> 'Current Org' item. Filter the table for 'sid'.
  5. Test each 'cookie' value until finding the one that works.

We obtained an access token: 00D240000*********oVjV75s3.

Image

Command Executed:

SF_ACCESS_TOKEN=<AccessToken>
$ sf org login access-token --instance-url 'https://enelcrmt.my.salesforce.com' --alias PROD --no-prompt

We also try different instance-url but notting change 😔
Doc info we follow

Error Message:

Error (AuthCodeUsernameRetrievalError):
Could not retrieve the username after successful auth code exchange.
Due to: Bad_OAuth_Token

Additional Information:

  • The same token worked when using ANT, which is discontinued.
  • The token was passed correctly to sf-cli, as it worked in the sandboxes on the same day.

We request further information and assistance regarding this issue.

System Information

 CLI Version:
        @salesforce/cli/2.82.6 published 12 days ago (Wed Mar 26 2025)

 Architecture:
        darwin-arm64

 Node Version:
        node-v23.10.0

 Plugin Version:
        @oclif/plugin-autocomplete 3.2.26 (core)
        @oclif/plugin-commands 4.1.22 (core)
        @oclif/plugin-help 6.2.27 (core)
        @oclif/plugin-not-found 3.2.48 (core)
        @oclif/plugin-plugins 5.4.36 (core)
        @oclif/plugin-search 1.2.23 (core)
        @oclif/plugin-update 4.6.35 (core)
        @oclif/plugin-version 2.2.27 (core)
        @oclif/plugin-warn-if-update-available 3.1.38 (core)
        @oclif/plugin-which 3.2.34 (core)
        @salesforce/cli 2.82.6 (core)
        apex 3.6.11 (core)
        api 1.3.3 (core)
        auth 3.6.107 (core)
        data 4.0.23 (core)
        deploy-retrieve 3.21.1 (core)
        info 3.4.50 (core)
        limits 3.3.51 (core)
        marketplace 1.3.7 (core)
        org 5.5.5 (core)
        packaging 2.12.3 (core)
        schema 3.3.57 (core)
        settings 2.4.21 (core)
        sobject 1.4.53 (core)
        telemetry 3.6.36 (core)
        templates 56.3.43 (core)
        trust 3.7.75 (core)
        user 3.6.15 (core)
        sfdx-plugin-source-read 1.5.1 (user) published 18 days ago (Wed Mar 19 2025)

 OS and Version:
        Darwin 24.3.0

 Shell:
        zsh

 Root Path:
        /opt/homebrew/lib/node_modules/@salesforce/cli

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigatingWe're actively investigating this issuemore information requiredIssue requires more information or a response from the customerstalevalidatedVersion information for this issue has been validated

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions