Similar question asked about logging into Sandboxes with this error SFDX: Grant type not supported; here we look at logging into scratch orgs.


  • In your CLI you want to log into a scratch org that your CLI did not create. In my case, it was a scratch org created by our dev ops tool - Gearset. But it could just as easily be a colleague's scratch org or one you created from a different computer.


sfdx force:auth:web:login -r https://xxx-yyy-zzz-dev-ed.lightning.force.com -a someAlias
  • Successfully brings up a login screen
  • You enter username and password for that scratch org
  • CLI displays error grant type not supported and browser displays localhost error

How does one login to such a scratch org?

1 Answer 1


As in everything, the key is reading the authorization documentation closely

If you happened to be logged into that scratch org from some other tool or browser, you note that the URL for that org will look like:

Lightning: https://xxx-yyy-zzz-dev-ed.lightning.force.com/...
Classic: https://xxx-yyy-zzz-dev-ed.cs68.my.salesforce.com/

The doc clearly states that you need to use My Domain URL (scratch orgs have my domain enabled)

If the org you are authorizing is on a My Domain subdomain, update your project configuration file (sfdx-project.json). Set the sfdcLoginUrl parameter to your My Domain login URL.

Where it is easy to get confused is that the doc for the -r or --INSTANCEURL parameter for sfdx force:auth:web:login is defined as The login URL of the Salesforce instance that the org lives on. and you get sloppy and just copy-paste what you see in the browser.

A domain ending in ...dev-ed.lightning.force.com/ is not a login URL

So, change the -r parameter to end in my.salesforce.com:

sfdx force:auth:web:login -r https://xxx-yyy-zzz-dev-ed.my.salesforce.com -a someAlias

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .