SFDX Force:org:open fails and user is directed to the login screen

I have two scratch orgs that I’ve created this week, post Winter Release, that will not open from the command line using sfdx force:org:open. The login fails and I’m stuck staring at the login screen. Another dev on my team just experienced the same issue. Has anyone else?

Answer

I also experienced this issue this week and, while I’m not sure of the cause of it, I believe it has something to do with the URL that is generated by the SFDX CLI. This might be a bug that can be filed with the SFDX team. (Update: According to Salesforce, “we are pushing a fix in this weeks CLI release.”)

Failing Example

For the scratch org that doesn’t auto log me in from the CLI via sfdx force:org:open -u [OrgName], this message is generated:

Access org ### as user test-[removed]@example.com with the following URL: https://cs50.salesforce.com/secur/frontdoor.jsp?sid=[removed]

Working Example

For the scratch org that works as expected, this message is generated:

Access org ### as user test-[removed]@example.com with the following URL: https://computing-ruby-1278-dev-ed.cs24.my.salesforce.com/secur/frontdoor.jsp?sid=[removed]

In the example output where the CLI command works, notice that the My Domain is included in the URL (computing-ruby-1278-dev-ed)

Solution

If you grab the My Domain part of the URL when redirected to the login page, you should be able to login successfully by modifying the generated URL to include the My Domain.

Alternative Solution

An alternative solution is to generate a password for the user via the sfdx force:user:password:generate command and logging in that way.

Attribution
Source : Link , Question Author : Kelly Wood , Answer Author : Robert Watson

Leave a Comment