1. Install SFDX
The easiest way is to install via npm:
npm install sfdx-cli --global
To check if the sfdx
is installed or not:
sfdx --version
2. Authorize an org with the OAuth 2.0 webserver
In this step, you will need to login via a web browser to authorize the CLI application.
sfdx force:auth:web:login -r <login_url>
If the command hangs up too long, you can try the alternative way:
sfdx force:auth:device:login -r <login_url>
The login Url for the corresponding environment:
Environment | Url |
Production | https://login.salesforce.com |
Development | https://login.salesforce.com |
Sandbox | https://test.salesforce.com |
Pre-release | https://prerellogin.salesforce.com |
3. Get the Sfdx Auth Url
sfdx force:org:display --targetusername <your_user_name> --verbose
Example of result:
Depends on the environment, the Url will be used as:
- DEVHUB_AUTH_URL
- SANDBOX_AUTH_URL
- PRODUCTION_AUTH_URL
That’s all, please leave a comment if you have any question, I’ll reply as soon as I can.