0

Not sure what's going on here but I'm following the following trailhead and trying to authorize my dev org for use with vs code:

https://trailhead.salesforce.com/en/content/learn/projects/quick-start-lightning-web-components/create-a-hello-world-lightning-web-component

When I run the command:

sfdx force:auth:web:login --setalias vsCodeOrg --instanceurl https://login.salesforce.com --setdefaultusername

The browser opens to the login page then after I login i get the error:

This site can’t provide a secure connection

localhost sent an invalid response.

It redirects to https://localhost:1717/OauthRedirect?code={{code}}

I read many posts where the issue seems to be a network or firewall issue or another process already listening on that port. I verify that there's nothing listening on port 1717 before i run the sfdx command and when I run the command i'm not getting a refused error or anything in fact after I run the command in a separate window i run:

netstat -ano | findstr 1717

and can verify that the process listening on that port is sfdx. For good measure i tried to use a different port as others suggested by specifying oauthLocalPort in the sfdx-project.json file. When I do this the redirect still goes to port 1717 at which point I do get a connection refused, which I would expect as no one is listening there now, I change the port on the URL to the one i specified and i'm back to square 1 which is the error:

localhost sent an invalid response.

If anyone can shed anymore light on this it would be appreciated.

10
  • r u vscode commands are running any corporate firewall network?
    – sdandamud1
    Commented Jul 2, 2019 at 19:50
  • @sdandamud1 No i'm not Commented Jul 2, 2019 at 19:51
  • then you have to go through link salesforce.stackexchange.com/questions/226114/…
    – sdandamud1
    Commented Jul 2, 2019 at 19:55
  • @sdandamud1 I tried that already along with creating a new connected app and specifying a different port, no luck on both accounts Commented Jul 2, 2019 at 20:03
  • i think it's look like issue with your network, your machine network running under firewall
    – sdandamud1
    Commented Jul 2, 2019 at 20:10

2 Answers 2

0

It may be that your chrome HSTS settings force the use of https for localhost. See if deleting the HSTS for localhost per https://www.thesslstore.com/blog/clear-hsts-settings-chrome-firefox/ works for you.

0

As another answer points out, you need to clear your HTTP Strict Transport Security (HSTS) settings relating to Salesforce and Localhost.

  1. Open Chrome; navigate to chrome://net-internals/#hsts
  2. Into the Delete Domain Security Policies input field type in login.salesforce.com
  3. Click Delete
  4. Repeat steps 2 and 3 with test.salesforce.com and localhost

It's worth noting that I'm unaware of custom configurations you've completed on your system relating to development using the localhost hostname. If you have set up custom self-signed SSL certificates for example for other development reasons, doing this may clear those.

I've pulled some of my research on this issue from this stack overflow article.

You must log in to answer this question.

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