5

You can authorise an org in sfdx via this command

sfdx force:auth:web:login -r https://customer1customdomain.lightning.force.com -a customer1

When the org is SSO-enabled, I can only login by bypassing SSO by appending ?login to the URL:

https://customer1customdomain.lightning.force.com?login

However, I can't seem to make it authenticate the sfdx connected app.

How do you authorise sfdx in a SSO-enabled org?

1
  • 1
    what happens? It works fine for me if I use the following url https://domainname.my.salesforce.com. It opens a browser up which authenticates with SSO and says "successfully authorized" in the terminal Commented Apr 1, 2020 at 17:35

5 Answers 5

2

For anyone that lands here with the same question:

You can bypass SSO when you manually login by adding this parameter to the login URL https://mycompany.my.salesforce.com/?login

However, to authorize in VS Code or sfdx, use the URL login.salesforce.com

sfdx org login web -r https://login.salesforce.com -a mycompany.PROD

Sometimes adding lightning login helps

1
  • 1
    For orgs that enforce login through the company's subdomain, the login or test generic subdomains do not work. In those cases, prefer to use the company domain instead. Commented Aug 24, 2023 at 11:53
1

Try setting the instance URL in your auth call:

sfdx force:auth:web:login --setalias my-hub-org --instanceurl <your domain here>

You may also be able to configure a connected app to handle the additional auth requirements as seen here: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_connected_app.htm

and referenced here: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_web_flow.htm

0

sfdx force:auth:web:login --alias <youralias> --instance-url https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com/

0

I was running into an instance where the login screen for the sandbox was not configured to use SSO (only presented username/password).

Even if I was already logged in, using: sfdx force:auth:web:login --alias <youralias> --instance-url https://<MyDomainName>--<SandboxName>.sandbox.my.salesforce.com

Would take me to the login screen, and if I tried using the sandbox.lightning.force.com url, sfdx would tell me that's not allowed.

I was able to get it to work by switching to salesforce classic. I'm guessing setup the session cookie for the sandbox.my.salesforce.com which allowed to me to login using my current session.

-3

This worked for me for Connecting SF org and i have SSO enabled on SF login.

If you want to connect to a custom domain org, you can use the URL https://<yourdomain>.my.salesforce.com, where <yourdomain> is the name of your custom domain.

1
  • 2
    Is this distinct from the 2 existing answers, or is it a "this existing answer worked for me"? If it's the latter, then you should delete this and upvote the answer you thought was helpful. If it is supposed to be a distinct answer, then you need to edit your answer so that the stuff you have inside of the angle brackets gets rendered as text (the site interprets it as html and prevents it from being displayed for security reasons).
    – Derek F
    Commented Nov 27, 2023 at 22:02

You must log in to answer this question.

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