[SalesForce] Unable to Authorize Salesforce org using SFDX : Trailhead

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?

Best Answer

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

Related Topic