1

When I directly go to the url https://test.salesforce.com/?un=test%40example.com.sbname (using @ instead of %40 works as well) from a browser, sandbox login page opens up with prefilled username value test@example.com.sbname.

enter image description here

If I use the command,

sfdx force:auth:web:login -r https://test.salesforce.com/?un=test%40example.com.sbname

login page opens up with additional text

enter image description here

Is there a way to do prevent/remove those added parameters and open a sandbox login page just like the first example?

6
  • Instead of passing it through the instance URL, what happens if you use the --setdefaultusername parameter instead Oct 23, 2019 at 13:59
  • @BryanAnderson --setdefaultusername doesn't accept any argument and looking at its description, I am not sure if I can use that for my case. Sets the authenticated org as the default username that all commands run against.
    – Lafexlos
    Oct 23, 2019 at 14:25
  • Can you try sfdx force:auth:web:login -r https://test.salesforce.com/?un=test%40example.com.sbname& Nov 11, 2019 at 13:47
  • @TusharSharma For windows command line, works as the same and Powershell doesn't allow ampersand. Using sfdx force:auth:web:login -r "https://test.salesforce.com/?un=test%40example.com.sbname&" in powershell also resulted as above.
    – Lafexlos
    Nov 11, 2019 at 14:15
  • 1
    @Lafexlos Why do you want to accomplish this in the first place? Could be an XY Problem situation here Nov 14, 2019 at 14:33

1 Answer 1

1
+50

The -r or --instanceurl param is just supposed to point to the right endpoint environment. I don't think you can achieve what you're looking for within the CLI command itself.

Official Documentation for auth:web:login doesn't give URL param options as an example, nor suggests that this could be done

-r | --instanceurl INSTANCEURL Optional - The login URL of the Salesforce instance that the org lives on.

You must log in to answer this question.

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