Skip to main content Join us at TDX in San Francisco or on Salesforce+ on March 5-6 for the Developer Conference for the AI Agent Era. Register now.
Hello!

I created a new project with manifest in VS Code, but I am not able to authorize an Org(sandbox) to it. When I run:

sfdx force:auth:web:login --setalias <alias> --instanceurl <sanboxURL> --setdefaultusername

, it opens the authentication screen, then I insert login + password and it redirects me to localhost:1717 with the following error: 

Error authenticating with auth code due to: authentication failure

This is most likely not an error with the Salesforce CLI. Please ensure all information is accurate and try again.

,in vsc it shows me the following error:

ERROR running auth:web:login:  Invalid client credentials. Verify the OAuth client secret and ID. Error authenticating with auth code due to: authentication failure

VS Code Version: 1.56.2

SFDX CLI Version: sfdx-cli/7.102.0 win32-x64 node-v16.1.0

Salesforce Extension Pack: 51.14.0

 
17 answers
  1. Mar 21, 2023, 3:11 PM
    Using custom url option with salesforce classic login url solved the issue for me.

    Here's what I did

    1. Login to salesforce org

    2. Switch view to salesforce classic from "view profile" option at the top right corner

    3. Log out (click on user name)

    4. Copy the url from logged out page

    5. Use this url in the Custom option while Authorizing an org

    Example: https://<domain-name>.my.salesforce.com
  2. May 24, 2021, 2:17 PM

    Hi Miguel,

    Check this Solution from @Vishesh Maskey (https://developer.salesforce.com/forums/?id=9062I000000IDtcQAG)

    After working with Salesforce Support, I was able to fix my issue using this article (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_cli_env_variables.htm) below. I am not sure we can assign a port, it will basically redirect back to 1717. On the article all you do is add a new Environment Variable as described at the bootom of the page on the article and it worked.

    Add Environment Variable NODE_TLS_REJECT_UNAUTHORIZED with a Value of 0

    Try this way too. Open your project and Try using the command pallette . Press (Ctrl + Shif + P) or Go to View > Command Pallette.

    Type 'Authorize an org' > Select Sandbox > Type an Alias or any name > then you will taken to authorize in a browser. Login and you should be good to go. Try logging in sandbox in the same browser prior of doing all these steps which will make it easy.

    Hope you find your solution quickly. Do Mark this suggestion as Best Answer if it helps.

    Thank you

  3. Mar 4, 2024, 9:02 PM

    sfdx org:login:web --alias cona --instance-url https://test.salesforce.com --set-default

    Warning: Ignoring extra certs from `null`, load failed: error:02001002:system library:fopen:No such file or directory

     Â»   Warning: org:login:web is not a sfdx command.

    Did you mean plugins? [y/n]: 

     Â»   Error: Run sfdx help for a list of available commands.

    02:30:50.897 sfdx org:login:web --alias cona --instance-url https://test.salesforce.com --set-default

     ended with exit code 127

     

    Please help on this error.

  4. Aug 27, 2021, 1:38 PM
    @miguelm,

    What is mean by connection error? I am receiving same error, although i never received such error, and therefore wanted to know what made you fix this?
0/9000