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
Andy Kallio 7Andy Kallio 7 

Can't authenticate with cli

Hello. I am trying to learn my way around the CLI. It is properly installed. I cannot seem to authenticate with any org. 

Using the command 
sfdx force:auth:web:login
The browers will open a login page at the default login.salesforce.com. I enter the credentials and the get the following messages.

On my browser I get: 'local host did not send any data'

On the terminal I get: 
ERROR:  Command failed with response.
 - security: SecKeychainItemCreateFromContent (<default>): The user name or passphrase you entered is not correct.
. 

Try this:
Determine why this command failed to set an encryption key for user andykallio: [/usr/bin/security add-generic-password -a local -s sfdx -w 7e91f8815b82c8172111410fa91dc6a8].


I have tried this with my production, and sanbox orgs and I am definitely entering the right username and password. 

 

I have uninstalled/reinstalled the cli. 

My IT guy says there are not any IP restrictions that he is impossing. 

Any ideas would be really appreciated. Thanks!

Best Answer chosen by Andy Kallio 7
Andy Kallio 7Andy Kallio 7
Here is what fixed it for me:

Try opening Keychain Access.app. Right-click on the login keychain and try locking it and then unlocking it again.

All Answers

Khan AnasKhan Anas (Salesforce Developers) 
Hi Andy,

Greetings to you!

First, delete all the references to the CLI  and install it again.

Delete all the references to the CLI with the following commands:
sudo rm -rf /usr/local/sfdx
sudo rm -rf /usr/local/lib/sfdx
sudo rm -rf /usr/local/bin/sfdx
sudo rm -rf ~/.local/share/sfdx ~/.config/sfdx ~/.cache/sfdx
sudo rm -rf ~/Library/Caches/sfdx

And then install it again:
https://developer.salesforce.com/tools/sfdxcli

Also, make sure you don't have a firewall or proxy that is interfering. The URL should work under normal circumstances. And check whether loginUrl is your custom domain.

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Andy Kallio 7Andy Kallio 7
Hello Khan. Thanks for this. I have done it already. I also found that there was a hidden directory that was storing some config related to login. So, I removed that as well before reinstalling the cli. Still the same result. I use a custom domain but do not require it for login. In any case, I tried using the custom domain with the -r flag. I am also pretty sure there is no firewall and there is no proxy server. I get the same error when trying this from my home network as I do from my work network. 
Andy Kallio 7Andy Kallio 7
Here is what fixed it for me:

Try opening Keychain Access.app. Right-click on the login keychain and try locking it and then unlocking it again.
This was selected as the best answer
Paulina Cajiao AlvaradoPaulina Cajiao Alvarado
Did you find any solution on this? I am having the same exact problem.