You need to sign in to do that
Don't have an account?

Salesforce CLI: auth web login issue
I properly installed CLI. In a command window, I enter:
sfdx force:auth:web:login -d -a DevHub
in order to log in to the trial Dev Hub that I created. The aforementioned command opens the Salesforce login page in the web browser, so I log in using my Developer Hub Trial Org credentials and click Allow. After that, web browser show me an error: "This site can't be reached. localhost took too long to respond".
This is the URL that Salesforce use after I authenticate in the browser: http://localhost:1717/OauthRedirect?code=aPrxbOND3gL_2LbSR7rKPdvD0XBVk2YpErl3pphY2f3xvZ1wf5SSPJByDleRLPMtzCQWnNGAdg%3D%3D&state=f2f8254fac23
I don't know what happen.



sfdx force:auth:web:login -d -a DevHub
in order to log in to the trial Dev Hub that I created. The aforementioned command opens the Salesforce login page in the web browser, so I log in using my Developer Hub Trial Org credentials and click Allow. After that, web browser show me an error: "This site can't be reached. localhost took too long to respond".
This is the URL that Salesforce use after I authenticate in the browser: http://localhost:1717/OauthRedirect?code=aPrxbOND3gL_2LbSR7rKPdvD0XBVk2YpErl3pphY2f3xvZ1wf5SSPJByDleRLPMtzCQWnNGAdg%3D%3D&state=f2f8254fac23
I don't know what happen.
Authorize the CLI to work with your DevHub by typing: This will automatically open your browser and prompt you to login to the dev hub. Use the credentials that you used to create the Salesforce DX authorized dev hub. Click Allow when the Oauth Flow prompts you to.
Once you’ve gone through this authorization process you can set up an alias using the following command You should see something like: Now you should be able to open the dev hub using this Let me know if this works
All Answers
Pleas make sure you created alias DevHub already by using the following command
This is the result:
ERROR: No org configuration found for name DevHub. ERROR: No scratch orgs can be found.
I think the problem is auth response. After I authenticate in the browser, the CLI doesn't receive my Dev Hub credentials, so the "Successfully authorized xxxx@xxxxx.xxx with org id 000000000000" message doesn't appears in the console.
Do you have a DevHub Org? otherwise you first have to create a DevHub using the below link
https://developer.salesforce.com/promotions/orgs/dx-signup
Now when you do the following You should see something like thisthen loing to the above Org created using this command line in you CLI.
I see above you are haing issues login into your DevHub. Whey it is directing to localhost.....
I login into DevHub Org without problem when I use https://login.salesforce.com/ login page. However, when I use command line in my CLI in order to login, the redirect option fail (callback) and CLI doesn't connect with my DevHub Org
Authorize the CLI to work with your DevHub by typing: This will automatically open your browser and prompt you to login to the dev hub. Use the credentials that you used to create the Salesforce DX authorized dev hub. Click Allow when the Oauth Flow prompts you to.
Once you’ve gone through this authorization process you can set up an alias using the following command You should see something like: Now you should be able to open the dev hub using this Let me know if this works
Thanks you so much!
I have following your steps and these resolve the problem. However I changed a bit your first command, I removed -h flag, so I used the following command:
I have been trying to log in to dev hub using the CLI but weirdly when I use the force:auth command the browser doesn't even open. I am very new to using the CLI and please let me know if I'm missing something.
Thanks in advance!
! 'ENOENT': spawn cmd ENOENT
- If stuff stopped working recently, go into your Control Panel, then Programs and Features, and sort by install date; look at recent installs
- If uninstalling recent, but dispensible stuff that might affect security/networking doesn't get you a fix, keep going...
- 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, and keep going
- Try next disabling other software, like "Intel(R) Management and Security Status" or other things clearly related to security
- If that fails start in safe mode (many ways to do this, like run "msconfig" and tell your computer to boot in safe mode with networking)
- Log in and try running "sfdx force:auth:web:login" from a CMD prompt again; if it works, some service is stopping things from working
- If you have your computer running in safe mode, run msconfig again and set it for a regular boot, then reboot and continue
- 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, 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.@ theseptemberguy
set http_proxy=<Username>:<Password>@host:port(try to set this in command prompt )
Replace ur Username,password,host and port something like ths
set http_proxy=mvangala:March2019@sgproxy.gfoundries.com:8080(For my system)
it will work
attempted run the command --> sfdx force:org:create -s -f config/project-scratch-def.json -a GeoAppScratch
Received the error --> "Must pass a username and/or OAuth options when creating an AuthInfo instance."
Followed the above solution posted by [Angela Ramirez 1].
* Used the recommended command [sfdx force:auth:web:login]
* Then reran the command [sfdx force:org:create -s -f config/project-scratch-def.json -a GeoAppScratch]
Resulted in --> "Successfully created scratch org:"
Thank you for helping!
'ENOENT': spawn cmd ENOENT'
Try to verify the enviroment variable 'Path'. You need to specify the path of CMD. If you dont specify this, the cmd launch in the project path and you need launch this in system32. Also, verify the port 1717 if this is free with the command netstat -ano | findstr 1717 and then kill with TASKKILL /F /PID 17956. Moreover, you 'Path' need 3 path (Salesforce bin folder path - Visual code bin folder path - CMD path) for example:
C:\Program Files\Salesforce CLI\bin;C:\Users\herna\AppData\Local\Programs\Microsoft VS Code\bin;C:\Windows\System32;
And finally verify if you have JDK_HOME and JAVA_HOME enviroment variable set in your pc.
With this action i could to launch vscode succesfully whit any command and i could to deploy my first apex class.
Please tell me if this information was useful for you.
Regards!
:)
Hi @meena Vangala,
Still i am facing the same issue i am connecting vscode with my project sandbox , i am getting below error. Please help .

Hi @Viswanath Kambhampati 12
what you have done for the error . can you explain
Please use the below command
sfdx force:auth:web:login -r https://login.salesforce.com
or
sfdx force:auth:web:login --setdefaultdevhubusername --setalias my-hub-org
Make sure you enable devhub in your org
you can change the url of production to your Sandbox
Can you please help me out how you are able to solve localhost:1717 error post login to salesforce.
Can you shared your sfdx-project.json file contents? I am interested to see what is the sfdcLoginurl you have set.
Also, make sure you have the following permission sets:
This work for me set all the three paths to system path variable and JAVA_HOME path now it's work in VS Code
But still i am facing the issue as localhost 1717 error. I have checked for PID but didnt found any.
I have added below parameter in sfdx project json but no luck.
"oauthLocalPort" : "1919"
Is there anything that i am missing here?
Regards,
Sai
2. It it wont fix the issue, then you need to kill the process currently using a port on localhost in windows
https://stackoverflow.com/questions/39632667/how-to-kill-the-process-currently-using-a-port-on-localhost-in-windows
I am also facing Localhost issue .
I had the exect same problem with localhost:1717 with the web login flow, so I used the device flow instead
reference:https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference_force_auth.htm#cli_reference_device_login
Thank you!
I get the same error as the guy in the top mentioned and even after following all the steps you guys have mentioned, my issue is still not resolved.
How to solve this issue?
Help me I have spent my whole half day fixing this issue and still there is no luck.
The Salesforce CLI use NodeJS to handle the authentication between client and Salesforce server
When you use a proxy or your network not transparent the https will occur the error
You can skip the error by set bellow variable in environment on your pc
NODE_TLS_REJECT_UNAUTHORIZED = 0
Note: you must restart the CMD or VSC after set variables.
How to creating and Modifying Environment Variables on Windows
https://docs.oracle.com/en/database/oracle/r-enterprise/1.5.1/oread/creating-and-modifying-environment-variables-on-windows.html
ERROR running force:package:install: Must pass a username and/or OAuth options when creating an AuthInfo instance.
on line
sfdx force:package:install --package $PACKAGE_VERSION_ID --wait 10 --publishwait 6 --noprompt
ERROR running force:auth:web:login: Command failed with response.
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
- The argument 'C:\Users\Kid Jansen\AppData\Local\sfdx\client\7.48.0-a71f8c6899\node_modules\salesforce-alm\CredMan.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.
Try this:
Determine why this command failed to get an encryption key for user Kid Jansen: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -File C:\Users\Kid Jansen\AppData\Local\sfdx\client\7.48.0-a71f8c6899\node_modules\salesforce-alm\CredMan.ps1 -GetCred -Target sfdx -User local].
Running the following versions and settings:
What I've tried so far:
It used to work on this machine up until a few months back. It also works on my work laptop (Capgemini, so that'll have a ton more security enabled) on any network I've tried so far (home, at office, at customer), but like said it doesn't work on my desktop PC on my home network.
I was getting the same error as the original post, "Verify the OAuth configuration for this org. For JWT" <_<
What solved it for me was in the .sfdx folder C:\Users\[myname]\.sfdx there was a myuser@companydomain.com.json file. This file contained some tokens and my username. Deleting this file, then retrying SFDX: Authorize an Org worked. Perhaps it was trying to auth with these expired tokens?
As a takeaway I at least learned about the sfdx force:auth:device:login -r mydomain.my.salesforce.com command which is a neat way to connect.
Modify your sfdx-project.json file.
Change sfdcLoginUrl from lightning.force.com to my.salesforce.com.
Then run (VSCode) SFDX: Authorize an org | Choose Project Default | Call it something | Login | Allow access
Example:
Change: "sfdcLoginUrl": "https://insane-membrane-744iv7-dev-ed.lightning.force.com",
to: "sfdcLoginUrl": "https://insane-membrane-744iv7-dev-ed.my.salesforce.com"
Happy New Year. 12/28/2020 Troy ~ Seattle.
https://javatutorial.net/set-java-home-windows-10
This helped me. After that I am able to authorized org on SFDX
In fact, I also struggled a lot with the various methods mentioned above, but finally i could able to authorize with device based login i.e.
e.g. sfdx auth:device:login -d -a TestOrg1
You need to manually open the URL in the new window and enter the code mentioned below e.g.
C:\Users\48249>sfdx force:auth:device:login -d -a DevHub
=== Action Required!
Enter 05H792KZ user code in the verification URL https://login.salesforce.com/setup/connect