Newer Version Available

This content describes an older version of this product. View Latest

accesstoken Commands

Authorize an org using an access token.

auth:accesstoken:store

Authorize an org using an existing Salesforce access token.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style org login access-token command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --setdefaultdevhubusername. New name: --set-default-dev-hub.
  • Changed flag name: Old name --setalias. New name: --alias.
  • Changed flag name: Old name --instanceurl. New name: --instance-url.
  • Changed flag name: Old name --setdefaultusername. New name: --set-default.
  • Changed flag name: Old name --noprompt. New name: --no-prompt.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on March 2, 2023.

Warning

Help for auth:accesstoken:store

By default, the command runs interactively and asks you for the access token. If you previously authorized the org, the command prompts whether you want to overwrite the local file. Specify --noprompt to not be prompted.

To use the command in a CI/CD script, set the SFDX_ACCESS_TOKEN environment variable to the access token. Then run the command with the --noprompt parameter. "<org id>!<accesstoken>"

Examples for auth:accesstoken:store

1sfdx auth:accesstoken:store --instanceurl https://mycompany.my.salesforce.com

$ export SFDX_ACCESS_TOKEN=00Dxx0000000000!xxxxx

1sfdx auth:accesstoken:store --instanceurl https://dev-hub.my.salesforce.com --noprompt

Command Syntax

sfdx auth:accesstoken:store
[--json]
[--loglevel LOGLEVEL]
-r INSTANCEURL
[-d]
[-s]
[-a SETALIAS]
[-p]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-r | --instanceurl INSTANCEURL
Required

The login URL of the instance the org lives on.

Type: url
-d | --setdefaultdevhubusername
Optional

Set the authenticated org as the default dev hub org for scratch org creation.

Type: boolean
-s | --setdefaultusername
Optional

Set the authenticated org as the default username that all commands run against.

Type: boolean
-a | --setalias SETALIAS
Optional

Set an alias for the authenticated org.

Type: string
-p | --noprompt
Optional

Do not prompt for confirmation.

Type: boolean

Aliases for auth:accesstoken:store

1force:auth:accesstoken:store