jwt Commands

Authorize an org using JWT.

auth:jwt:grant

Authorize an org using the JWT flow.

Help for auth:jwt:grant

Use a certificate associated with your private key that has been uploaded to a personal connected app.

If you specify an --instanceurl value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file. To specify a My Domain URL, use the format MyDomainName.my.salesforce.com (not MyDomainName.lightning.force.com). To specify a sandbox, set --instanceurl to https://test.salesforce.com.

Examples for auth:jwt:grant

sfdx auth:jwt:grant -u me@my.org -f <path to jwt key file> -i <OAuth client id>

sfdx auth:jwt:grant -u me@my.org -f <path to jwt key file> -i <OAuth client id> -s -a MyDefaultOrg

sfdx auth:jwt:grant -u me@acme.org -f <path to jwt key file> -i <OAuth client id> -r https://acme.my.salesforce.com

Command Syntax

sfdx auth:jwt:grant
[--json]
[--loglevel LOGLEVEL]
-u USERNAME
-f JWTKEYFILE
-i CLIENTID
[-r INSTANCEURL]
[-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/.sfdx/sfdx.log.

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

Authentication username.

Type: string
-f | --jwtkeyfile JWTKEYFILE
Required

Path to a file containing the private key.

Type: filepath
-i | --clientid CLIENTID
Required

OAuth client ID (sometimes called the consumer key).

Type: string
-r | --instanceurl INSTANCEURL
Optional

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

Aliases for auth:jwt:grant

1force:auth:jwt:grant