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
Amit Jadhav 13Amit Jadhav 13 

Kill the process running on port 1717 or use a custom connected app and update OauthLocalPort in the sfdx-project.json file.

Kill the process running on port 1717 or use a custom connected app and update OauthLocalPort in the sfdx-project.json file.
Sruthi SunderRajanSruthi SunderRajan

1.Go to the Terminal of the Visual studio and Enter the command 'sfdx force:auth:device:login' .

2. Enter ABCDD user code in the verification URL . ( enter the autogenerated code on your screen ).
3. Login successful for You can now close the browser.

Marie Bertaud 5Marie Bertaud 5
Thank you very much Sruthi, it's works very well !
sagar bharmalsagar bharmal
Thanks Sruthi !!  it's works very well !
Radhika ChRadhika Ch
Thank you so much Sruthi.It's worked ausome.You have saved my time.
Sujeet P 9Sujeet P 9
Go to sfdx-project.json file and check the attribute sfdcLoginUrl . If you are trying to log into sandbox, make sure the attribute value is Also verify the sourceApiVersion attribute.
Atul Ganorkar 20Atul Ganorkar 20

@Sruthi SunderRajan - worked perfectly.  Many thanks.
Shilpa KY 1Shilpa KY 1

This will help too.

Troy CenterTroy Center
WINDOWS PC Only... (don't use taskmanager!)

Using VSCode, open a new "cmd" terminal
OR Using Command Prompt for Windows (Click start, type "cmd" press enter)

1) c:\ netstat -ano | findstr :1717
-a = Displays all connections and listening ports.
-n = Displays addresses and port numbers in numerical form.
-o = Displays the owning process ID associated with each connection.

2) c:\ taskkill /PID [YOUR PID] /F
/F = Specifies to forcefully terminate the process(es).

User-added image

3) Press F1 and do SFDX: Authorize an Org. 
Wait for the CLI to pop up and ask questions, don't interrupt it. Name your connection and GO! It should work now. 

Note about sfdx_project.json:
I recommend using your mydomain name for the sfdcLoginUrl in the sfdx-project.json file. Just make sure you get it from Classic, not Lightning. It should look like this:  "sfdcLoginUrl": "". 
Troy CenterTroy Center
@Sruthi SunderRajan - There is one more step or else I get the error. - Authorize the org again. It should work this time! I logged back in to say thanks. This works really well. Troy ~ Seattle

Sonu Kumar SahSonu Kumar Sah
I closed the VS code and reopened it again, and tried to authorize it. It worked.
manjunath kademanimanjunath kademani
this link will solve the issue
Alefe Pereira TitoAlefe Pereira Tito
I already did everything you guys seid, but still have the msg "SFDX: Authorize an Org failed to run"