SFDX Tip & Tricks : Login to a Sandbox Org with the SFDX CLI
In general, the default login is pointed to https://login.salesforce.com, But when you wanted to try login to the sandbox using salesforce cli command sfdx force:auth:web:login it doesn’t work as it will route you to https://login.salesforce.com/*****.
Please also note that changing the https://login.salesforce.com/***** to https://test.salesforce.com/***** and entering the credentials also doesn’t work and you will see the error.
So In order to connect to the sandbox, we need to mention the instance URL in the command.
i.e.
-r, –instanceurl=instanceurl the login URL of the instance the org lives on
sfdx force:auth:web:login -r https://test.salesforce.com
OR
sfdx force:auth:web:login --instanceurl=https://test.salesforce.com
If we specify an –instanceurl / -r value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file.
Comments
Leave a Comment