All Collections
FAQ
Connections and authentication
Can I set a username and password on my scratch org?
Can I set a username and password on my scratch org?
Oli Lane avatar
Written by Oli Lane
Updated over a week ago

When you create a scratch org in Gearset, there's no need to remember a username and password - Gearset will securely store a token to allow you to deploy to and from the org.

However, sometimes it's useful to have a username and password to authenticate other tools to the scratch org, such as Workbench or the Salesforce Extensions for Visual Studio Code. 

Setting a username and password on a scratch org

  • Go to the Salesforce orgs page in Gearset and locate your scratch org (at the bottom of the page, or using the Scratch orgs filter on the left-hand side). Click on the arrow button to see the username for your scratch org: 

  • Click on the Log into org link to log into the scratch org.

  • In the org, in Setup, in the Quick Find box, type users  and click on Users > Users:

  • Find the user called User, User in the list and select it. It should have the same username as was displayed within Gearset

  • At the bottom of the list, click Reset Password(s). You will receive an email with a link to set a new password for your username.

Using the scratch org with the CLI

Once you've set a password on your scratch org, you can connect to it using the CLI.

To do so, you'll need the My Domain login URL for your scratch org. When logged into the scratch org, your URL bar will look something like:

https://xxx-yyy-zzz-dev-ed.lightning.force.com/

To construct the My Domain URL, take the URL from your browser and replace the .lightning.force.com part with .my.salesforce.com. Your My Domain URL should look like:

https://xxx-yyy-zzz-dev-ed.my.salesforce.com

You can use this to log into the org with the force:auth:web:login command:

sfdx force:auth:web:login -r https://xxx-yyy-zzz-dev-ed.my.salesforce.com -a someAlias
Did this answer your question?