4

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
6

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
    Feb 28 '19 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
    Aug 24 '19 at 15:25
  • @henriqueCabral Best Answer for me, Thanks!
    – Bahman.A
    Sep 8 '20 at 20:44
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 anonymous@silly-something-phn5av.com 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!! May 9 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.