5

Installed VS code , Salesforce CLI.

iam doing salesforce trailhead Lightning web components. when i Authorize an org, keep on getting

ERROR: getaddrinfo ENOTFOUND login.salesforce.com
login.salesforce.com:443. 18:51:45.434 sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://login.salesforce.com --setdefaultusername ended with exit code 1

and

browser redirect to http://localhost:1717/OauthRedirect?code=XXXXX&state=df30635cbef2

I have added proxy settings in VS code also

set HTTP_PROXY=https://myID:pwd@proxy:port
set HTTPS_PROXY=https://myID:pwd@proxy:port

someone encountered the same issue?

0

8 Answers 8

8

Following my steps to make this work

  1. Login into the TrailHead Org.
  2. Log out, and copy the URL you have after you logout
  3. Use this URL to sfdx force:auth:web:login --setalias vscodeOrg --instanceurl --setdefaultusername

Example: sfdx force:auth:web:login --setalias vscodeOrg --instanceurl https://playful-goat-jcbl-dev-ed.my.salesforce.com/ --setdefaultusername

Wrong URL: https://playful-goat-jcbl-dev-ed.lightning.force.com

3
  • hi, its proxy issue. its working out of office network. so i completed the trailmix using my mobile data.. also the same its working in my Intellij immuninated cloud plugin.but still iam not convinced this VS code proxy issue.digging more on this.
    – Raja vel
    Commented Feb 28, 2019 at 9:06
  • This solved my problem. In my case, I was not using the correct domain of my Trailhead playgroud (and not XXXX.lightning.force.com). But instead of https, I had used http. Logging out of trailhead gave me the correct URL.
    – Vikram
    Commented Aug 24, 2019 at 15:25
  • Thanks, @Henrique Cabral. Yor post is very useful to me!
    – Vadym
    Commented Oct 13, 2022 at 18:17
1

I had some frustration with trying to authorize my trailhead playground org from VSCode, constantly receiving ERROR running force:auth:web:login: grant type not supported errors in VSCode and a localhost refused to connect error in the browser.

Finally, I just ran the following sfdx command from the command line (not in VSCode):

sfdx force:auth:web:login -a https://silly-something-phn5av-dev-ed.my.salesforce.com

Returned the following:

Successfully authorized [email protected] with org ID 00D4W123452UxdJUAS
You may now close the browser
1

I had the same issue, and want to share my solution. First of all, I read a ton of information about this problem from google and tried different solutions, but nothing could help me. I use Ubuntu 20.04. So I decided to reinstall Salesforce CLI. After installing I tried: sfdx --version, and see: sfdx-cli/7.82.0-3d0c527ac6 linux-x64 node-v12.18.3. The Node version is 12.18.3, BUT I used the latest LTS: 14.15.4. So I used nvm to install Node 12.18.3 and use this version as the default version. And all works. Hope this information will be useful for those, who search solution.

1
  • Thx. Your solution is working for me! updated sfdx-cli and Works!! Commented May 9, 2021 at 12:03
0

I deactivated the Windows Defender. Make sure that the port specification in the archive sfdx-project.json in your project doesn't have a port property or is different to 1717. Also, verify that the port 1717 is free using the command:

netstat -ano | findstr 1717

If this port is in use so kill it

TASKKILL /F /PID 17956

Also, i try to connect with my org in my work network and dosent work and with my network (cellphone) works fine.

4
0

Check and get your proxy settings. Set your proxy in the windows Environment local variable for "HTTP_PROXY" and "HTTPS_PROXY". You may need to log off your machine.

0

If your are connecting to a sandbox, edit your sfdx-project.json file to set sfdcLoginUrl to https://test.salesforce.com before you authorize the org. Here's the config that I'm using

{
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    }
  ],
  "namespace": "",
  "sfdcLoginUrl": "https://test.salesforce.com/",
  "sourceApiVersion": "50.0"
}

https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_develop_any_org.htm

0

Nothing of the mentioned worked for me.

Ended up just resetting the org password and creating a new VS Code SFDX project. Only then the Auth Org worked. I also matched the Node version to SF CLI, but unsure if that contributed to the success.

0

Insane this issue is still around as of 2023. Hopefully I'm the problem and I've somehow managed to miss the permanent/final fix for this issue (???) but I'm still running into this issue as of 1/31/23. I used to be able to switch the port from 1717 to 1771 in the browser address bar when it failed and that would work but this morning even that trick fails for me.

Thanks to this below forum post from SFDC I can get in via device auth for now ... but sure hope the built-in/SFDX method gets fixed for good one day.

None of the solutions above work, nor should they be used.

Salesforce CLI is just broken,
So until Salesforce fix it use:
sfdx auth:device:login -a MyAlias -r https://<mydomain>--<sandbox>.my.salesforce.com -s

You must log in to answer this question.

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