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
Randall ToepferRandall Toepfer 

Visual Studio OAuth

I'm getting an error on sfdx cli authorize an org.  I'm experiencing the error on two different Salesforce orgs on two, accessed by two different laptops (my corporate laptop and personal laptop used for freelancing), and on two different networks (my corporate VPN and home network).

The error is:

We can't authorize you because of an OAuth error. For more information, contact your Salesforce administrator.
OAUTH_APPROVAL_ERROR_GENERIC : An unexpected error has occured during authentication. Please try again.

I've tried setting "relaxing ip restrictions" on the Salesforce CLI app, and tried running the sfdx authorize command with the scope in the url:

sfdx force:auth:web:login -r https://login.salesforce.com/services/oauth2/authorize?prompt=login&scope=full

Nothing is working and the OAuth hangs until I hit refresh and then get the above error.  I've tried in Firefox and Chrome browsers and after deleting cache.

Anyone know of a solution?  Thanks
SwethaSwetha (Salesforce Developers) 
Hi Randall,
Was this working earlier? Has there been any update to SFDX recently?

Can you try sfdx auth:web:login instead of sfdx force:auth:web:login 

Thanks
Randall ToepferRandall Toepfer
Its an issue with the Salesforce CLI that has been reported on Github.

https://github.com/forcedotcom/cli/issues/881
Malika Pathak 9Malika Pathak 9
Hi Randall,

I also faced the same issue after I update CLI but I rollback to the old version and now it is working fine.
you should also rollback to the old version of CLI.

Thanks.