2

Using VS Code, after I enter the command line "Authorize an org" I get redirected to Salesforce login and can successfully log in. However I then get the error

"This site can't be reached" The URL displayed used is http://localhost:1717/OauthRedirect?code=aPrxSV6UAcNrPEmQv5Rcj1tOKwXOkQhSqqbQE8Skbj7KLvIetoWmK4wCx0yNhoHrSP7OV95DAA%3D%3D&state=7ec3c8452f21

I am in a company network so cannot check if port 1717 is free/allowed. Should I try to change the redirection URL to another port using a connected app ? I am a bit lost here. Any help much appreciated. Thanks !

enter image description here

Edit (21/2) - Apparently I cannot add a comment to my own question on this forum so editing the original post - I am 100% sure I am not connected behind a proxy

Edit (22/2) - This is my work computer so I don't have permission to do many things ... What is really weird is that I can successfully connect to Salesforce using CLI through command line

  • 1
    You would need to configure proxy settings, in case you're under corporate firewall. – Raul Feb 11 at 17:51
1

Seems like what's happening is, SFDX sets up a temporary web server on your own computer so that when your OAuth flow is finished, the browser has a way of handing the token back to SFDX and signalling that it's completed the flow.

So if you are unable to reach that localhost:1717 URL... why? It's located on your own computer. So either you have an internal firewall that is blocking your computer from browsing to itself, or your browser is contacting something other than your local computer when it aims at "localhost" (hence why some suspected proxy settings). Or something has blocked SFDX from setting up the local server in the first place.

0
                          General Environment Variables

HTTP_PROXY

If you receive an error when you install or update the Salesforce CLI on a computer that’s behind a firewall or web proxy, set this environment variable. Use the URL and port of your company proxy, for example:

http://username:pwd@proxy.company.com:8080

HTTPS_PROXY

If you receive an error when you install or update the Salesforce CLI on a computer that’s behind a firewall or web proxy, set this environment variable. Use the URL and port of your company proxy, for example:

http://username:pwd@proxy.company.com:8080

Environment Variables

You can set environment variables to configure some values that Salesforce CLI and Salesforce DX tooling use.

Salesforce CLI Environment Variables

Environment variables override CLI runtime configuration values.

Reference:- Environment Variables and Use the Salesforce CLI from Behind a Company Firewall or Web Proxy

0

OK, the OP's edit says that proxies are not the issue.

Before looking too far afield, try looking at your event log for suspect errors; see if that helps you locate the source of the problem.

You can also try disabling all firewall and antivirus software, then run

sfdx force:auth:web:login

from a CMD prompt. If "sfdx force:auth:web:login" still fails, remember to re-enable your firewall/AV :-).

Try next disabling other software, like "Intel(R) Management and Security Status" or other things clearly related to security. If that fails to get "sfdx force:auth:web:login" working, you can try starting your computer in safe mode (many ways to do this, like run "msconfig" and tell your computer to boot in safe mode with networking; you can also often do this by banging the F8 key on boot, if you can get the timing right).

Log in (in safe mode) and try running "sfdx force:auth:web:login" from a CMD prompt again; if it works, some non-essential service is stopping things from working. Remember to run run msconfig again and reset the computer for a regular boot, then reboot and continue - assuming you have rights to do this.

To see what service might already be binding to port 1717 on the local host, run

netstat -ano | findstr 1717

from a CMD prompt. If you see a line of text that suggests something is in fact running on port 1717, run

netstat -ano | more

and hit the spacebar until you get down to that line; note the process and kill it.

There's more you can do, but eventually you'll want to grab someone with local knowledge, who can log into your machine and perform administrative tasks for you and troubleshoot. I'm hoping your employer sees this as part of doing your job.

0

Just simply add your windows environment local variable "HTTP_PROXY" and "HTTPS_PROXY", you may need to log off your machine.

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.