function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rebecca Hendricks 3Rebecca Hendricks 3 

sfdx force:auth:web:login -d -a DevHub error QuickStart: Salesforce Dx trail

I am trying to complete the Set Up Your Salesforce DX Environment module.  I have successfully created a test DX account and have installed the CLI (Windows x64 bit).  However, when I try and complete the next step, by entering sfdx force:auth:web:login -d -a DevHub into the command prompt, the browser (Chrome) asks me to login which I enter my credentials, but then when I click the Login button, the browser appears like it's going to a new page, but then it displays a page with a "This page isn't working localhost didn't send any data." error and the command prompt displays "ERROR: self signed certificate in certificate chain."

Does anybody know what I am doing wrong on getting to complete this step of the module?  Thanks.
Suraj PSuraj P
I believe the default app used for the web auth flow in sfdx uses port 1717. Another program on your machine may be already using that port. If so, either kill that program, or try logging in with your own connected app, using a different port. Make sure to modify your sfdx-project.json to specify the new port as
"oauthLocalPort" : "1919"

More info here:
https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_connected_app.htm
Rebecca Hendricks 3Rebecca Hendricks 3
@Suraj

Thanks for the information.  I actually had come across that article, but didn't know if I was a JWT-based authorization or not.  I am really new to the development stuff in Salesforce and even newer when it comes to command line items.  You mentioned about the port already being used for something, is there a way to find out what is using that port, as the only items I have open would be the Trailhead website so that I can get the instructions?  I'm also having a similar issue (getting the self signed certificate in certificate chain error) for a Heroku login from the command prompt.

The link you provided mentions steps on how to set the URL callback, but it states that I need to put in the Connected App Name and I'm not sure what the name of the app is.  Is this just a name I create so that I know what the OAuth is for?
Rebecca Hendricks 3Rebecca Hendricks 3
@Suraj

I was able to run the netstat -o in the command prompt and found my 1717 port, but it states that it's state is TIME_WAIT.  Is this mean that's it in use and is waiting for something? Or does this mean that it's "free to use"?
Suraj PSuraj P
It is probably sfdx itself, listening on port 1717. Do you know if you have an SSL intercept proxy in your network? If so, that may the issue and using jwt grant may be a better approach for you. Follow the steps in the documentation for creating a connected app in Salesforce. You will have to specify the clientid of the connected app on the command line once you've created the app and are ready to login with the jwt flow. Follow the steps in the documentation for JWT flow to create a self-signed certificate and server keys as well.
Rebecca Hendricks 25Rebecca Hendricks 25
@suraj

I saw the documentation and began working on it, however I wasn't sure what to put in the Connected App Name field.  Is this just something I create to know what the OAuth is for?  Also, the documentation states that I need to update the .json file.  As this is for a trailhead item and is related to the sfdx items, how do I get access to the .json file to update the port information?
Suraj PSuraj P
Yes, the Connected App Name would be something that makes sense to you, as to what the purpose of the app is. The sfdx-project.json file will be directly under your sfdx project folder.
Rebecca Hendricks 25Rebecca Hendricks 25
@suraj

Do you know how I can acccess the project folder?  I'm extremely new to sfdx and am not sure where that is located.  I've tried googling it and all the information seems to assume I know how to access the folder hierarchy and are displaying the information on a Mac (I'm using a PC).
Suraj PSuraj P
You would have to create the sfdx project folder first using the following command
sfdx force:project:create -n <yourprojectname>
The folder created as a result will have the sfdx-project.json file