@salesforce/plugin-auth
plugin for sfdx auth commands
Last updated 17 days ago by salesforce-releases .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @salesforce/plugin-auth 
SYNC missed versions from official npm registry.

plugin-auth

Auth commands for Salesforce CLI

This plugin is bundled with the Salesforce CLI. For more information on the CLI, read the getting started guide.

We always recommend using the latest version of these commands bundled with the CLI, however, you can install a specific version or tag if needed.

Install

sfdx plugins:install auth@x.y.z

Issues

Please report any issues at https://github.com/forcedotcom/cli/issues

Contributing

  1. Please read our Code of Conduct
  2. Create a new issue before starting your project so that we can keep track of what you are trying to add/fix. That way, we can also offer suggestions or let you know if there is already an effort in progress.
  3. Fork this repository.
  4. Build the plugin locally
  5. Create a topic branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
  6. Edit the code in your fork.
  7. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
  8. Sign CLA (see CLA below).
  9. Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.

CLA

External contributors will be required to sign a Contributor's License Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.

Build

To build the plugin locally, make sure to have yarn installed and run the following commands:

# Clone the repository
git clone git@github.com:salesforcecli/plugin-auth

# Install the dependencies and compile
yarn install
yarn build

To use your plugin, run using the local ./bin/run or ./bin/run.cmd file.

# Run using local run file.
./bin/run auth

There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.

# Link your plugin to the sfdx cli
sfdx plugins:link .
# To verify
sfdx plugins

Commands

sfdx auth:device:login [-i <string>] [-r <url>] [-d] [-s] [-a <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

authorize an org using a device code

USAGE
  $ sfdx auth:device:login [-i <string>] [-r <url>] [-d] [-s] [-a <string>] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -a, --setalias=setalias                                                           set an alias for the authenticated
                                                                                    org

  -d, --setdefaultdevhubusername                                                    set the authenticated org as the
                                                                                    default dev hub org for scratch org
                                                                                    creation

  -i, --clientid=clientid                                                           OAuth client ID (sometimes called
                                                                                    the consumer key)

  -r, --instanceurl=instanceurl                                                     the login URL of the instance the
                                                                                    org lives on

  -s, --setdefaultusername                                                          set the authenticated org as the
                                                                                    default username that all commands
                                                                                    run against

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

ALIASES
  $ sfdx force:auth:device:login

EXAMPLES
  sfdx auth:device:login -d -a TestOrg1
  sfdx auth:device:login -i <OAuth client id>
  sfdx auth:device:login -r https://test.salesforce.com

See code: src/commands/auth/device/login.ts

sfdx auth:jwt:grant -u <string> -f <filepath> -i <string> [-r <url>] [-d] [-s] [-a <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

authorize an org using the JWT flow

USAGE
  $ sfdx auth:jwt:grant -u <string> -f <filepath> -i <string> [-r <url>] [-d] [-s] [-a <string>] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -a, --setalias=setalias                                                           set an alias for the authenticated
                                                                                    org

  -d, --setdefaultdevhubusername                                                    set the authenticated org as the
                                                                                    default dev hub org for scratch org
                                                                                    creation

  -f, --jwtkeyfile=jwtkeyfile                                                       (required) path to a file containing
                                                                                    the private key

  -i, --clientid=clientid                                                           (required) OAuth client ID
                                                                                    (sometimes called the consumer key)

  -r, --instanceurl=instanceurl                                                     the login URL of the instance the
                                                                                    org lives on

  -s, --setdefaultusername                                                          set the authenticated org as the
                                                                                    default username that all commands
                                                                                    run against

  -u, --username=username                                                           (required) authentication username

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  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).

ALIASES
  $ sfdx force:auth:jwt:grant

EXAMPLES
  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

See code: src/commands/auth/jwt/grant.ts

sfdx auth:list [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

list auth connection information

USAGE
  $ sfdx auth:list [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

ALIASES
  $ sfdx force:auth:list

See code: src/commands/auth/list.ts

sfdx auth:logout [-a] [-p] [-u <string>] [--apiversion <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

log out from authorized orgs

USAGE
  $ sfdx auth:logout [-a] [-p] [-u <string>] [--apiversion <string>] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -a, --all                                                                         include all authenticated orgs
  -p, --noprompt                                                                    do not prompt for confirmation

  -u, --targetusername=targetusername                                               username or alias for the target
                                                                                    org; overrides default target org

  --apiversion=apiversion                                                           override the api version used for
                                                                                    api requests made by this command

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  By default, this command logs you out from your default scratch org.

ALIASES
  $ sfdx force:auth:logout

EXAMPLES
  sfdx auth:logout -u me@my.org
  sfdx auth:logout -a
  sfdx auth:logout -p

See code: src/commands/auth/logout.ts

sfdx auth:sfdxurl:store -f <filepath> [-d] [-s] [-a <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

authorize an org using an SFDX auth URL

USAGE
  $ sfdx auth:sfdxurl:store -f <filepath> [-d] [-s] [-a <string>] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -a, --setalias=setalias                                                           set an alias for the authenticated
                                                                                    org

  -d, --setdefaultdevhubusername                                                    set the authenticated org as the
                                                                                    default dev hub org for scratch org
                                                                                    creation

  -f, --sfdxurlfile=sfdxurlfile                                                     (required) path to a file containing
                                                                                    the sfdx url

  -s, --setdefaultusername                                                          set the authenticated org as the
                                                                                    default username that all commands
                                                                                    run against

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  Authorize a Salesforce org using an SFDX auth URL stored within a file. The file must have the format
  "force://<refreshToken>@<instanceUrl>" or "force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>".
  The file must contain only the URL or be a JSON file that has a top-level property named sfdxAuthUrl.
  Use this command to get the SFDX auth URL for a Dev Hub org you have already authorized:

       $ sfdx force:org:display -u <DevHub> --verbose

ALIASES
  $ sfdx force:auth:sfdxurl:store

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

See code: src/commands/auth/sfdxurl/store.ts

sfdx auth:web:login [-i <string>] [-r <url>] [-d] [-s] [-a <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

authorize an org using the web login flow

USAGE
  $ sfdx auth:web:login [-i <string>] [-r <url>] [-d] [-s] [-a <string>] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -a, --setalias=setalias                                                           set an alias for the authenticated
                                                                                    org

  -d, --setdefaultdevhubusername                                                    set the authenticated org as the
                                                                                    default dev hub org for scratch org
                                                                                    creation

  -i, --clientid=clientid                                                           OAuth client ID (sometimes called
                                                                                    the consumer key)

  -r, --instanceurl=instanceurl                                                     the login URL of the instance the
                                                                                    org lives on

  -s, --setdefaultusername                                                          set the authenticated org as the
                                                                                    default username that all commands
                                                                                    run against

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

DESCRIPTION
  To log in to a sandbox, set --instanceurl to https://test.salesforce.com.

ALIASES
  $ sfdx force:auth:web:login

EXAMPLES
  sfdx auth:web:login -a TestOrg1
  sfdx auth:web:login -i <OAuth client id>
  sfdx auth:web:login -r https://test.salesforce.com

See code: src/commands/auth/web/login.ts

Current Tags

  • 1.4.6                                ...           latest (17 days ago)
  • 0.0.6                                ...           test (2 months ago)

25 Versions

  • 1.4.6                                ...           17 days ago
  • 1.4.5                                ...           a month ago
  • 1.4.4                                ...           a month ago
  • 1.4.3                                ...           a month ago
  • 1.4.2                                ...           a month ago
  • 1.4.1                                ...           a month ago
  • 1.4.0                                ...           2 months ago
  • 0.0.6                                ...           2 months ago
  • 0.0.5                                ...           2 months ago
  • 0.0.5-test [deprecated]           ...           3 months ago
  • 0.0.4-test [deprecated]           ...           3 months ago
  • 0.0.3-test [deprecated]           ...           3 months ago
  • 1.3.3                                ...           3 months ago
  • 0.0.2-test [deprecated]           ...           3 months ago
  • 0.0.1-test [deprecated]           ...           3 months ago
  • 1.3.2                                ...           3 months ago
  • 1.3.1                                ...           3 months ago
  • 1.3.0                                ...           3 months ago
  • 1.2.0                                ...           4 months ago
  • 1.1.3                                ...           4 months ago
  • 1.1.2                                ...           4 months ago
  • 1.1.1                                ...           4 months ago
  • 1.1.0                                ...           4 months ago
  • 1.0.0-alpha                                ...           4 months ago
  • 1.0.0                                ...           5 months ago

Copyright 2014 - 2017 © taobao.org |