Newer Version Available

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

sfdxurl Commands (Deprecated)

Authorize an org using sfdxurl.

auth:sfdxurl:store (Deprecated)

Authorize an org using an SFDX auth URL stored within a file.

As of March 2, 2023, this command is deprecated and we no longer update this topic.

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 sfdx-url 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
  • 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 --setdefaultusername. New name: --set-default.
  • Changed flag name: Old name --sfdxurlfile. New name: --sfdx-url-file.

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:sfdxurl:store

The SFDX auth URL must have the format "force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>". NOTE: The SFDX auth URL uses the "force" protocol, and not "http" or "https". Also, the "instanceUrl" inside the SFDX auth URL doesn't include the protocol ("https://").

You have three options when creating the auth file. The easiest option is to redirect the output of the `sfdx force:org:display --verbose --json` command into a file. For example, using an org you have already authorized:

1sfdx force:org:display -u <OrgUsername> --verbose --json > authFile.json
1sfdx auth:sfdxurl:store -f authFile.json

The resulting JSON file contains the URL in the sfdxAuthUrl property inside of a results object. NOTE: The `force:org:display --verbose` command displays the refresh token only for orgs authorized with the web server flow, and not the JWT bearer flow.

You can also create a JSON file that has a top-level property named sfdxAuthUrl whose value is the auth URL. Finally, you can create a normal text file that includes just the URL and nothing else.

Examples for auth:sfdxurl:store

1sfdx auth:sfdxurl:store -f <path to sfdxAuthUrl file>
1sfdx auth:sfdxurl:store -f <path to sfdxAuthUrl file> -s -a MyDefaultOrg

Command Syntax

sfdx auth:sfdxurl:store
[--json]
[--loglevel LOGLEVEL]
-f SFDXURLFILE
[-d]
[-s]
[-a SETALIAS]

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
-f | --sfdxurlfile SFDXURLFILE
Required

Path to a file containing the sfdx url.

Type: filepath
-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

Aliases for auth:sfdxurl:store

1force:auth:sfdxurl:store