SFDX: Grant type not supported

The problem was that I was using the domain name instead of the plain test.salesforce.com.

This doesn't work:

sfdx force:auth:web:login -r https://xyz.lightning.force.com/ -a XYZ

but this works:

sfdx force:auth:web:login -r https://test.salesforce.com/ -a XYZ

@smukov is correct, don't use the lightning.force.com url. Instead find that url here for your sandbox and log in using the instance that shows in the url during Log In or in the sandbox "location" column.

enter image description here


The fix for me was to use the URL that the dev org redirected to after logout.

So I:

  1. Logged into the dev org
  2. Logged out of the dev org
  3. Copied the URL
  4. Executed this command in the terminal:

    sfdx force:auth:web:login -r https://random-domain-somenumber.my.salesforce.com -a DevHub

That did the trick for me