+ Start a Discussion
Arpan LahiriArpan Lahiri 

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.

Whenever i am trying to log in the following error message is coming:
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.
Please try to resolve
AbhishekAbhishek (Salesforce Developers) 
Hi,

My Findings are From the Named Credentials documentation, an important summary:

By separating the endpoint URL and authentication from the callout definition, named credentials make callouts easier to maintain. For example, if an endpoint URL changes, you update only the named credential. All callouts that reference the named credential simply continue to work.

Named Credentials insulate your code from specific endpoint URLs and from authentication details, and also provide secure storage for secret authentication parameters. The latter is a capability that is otherwise only possible by using a Protected Custom Setting in a managed package, which not every org has the capacity or inclination to do. Otherwise, you're stuck with storing highly sensitive authentication parameters, such as OAuth refresh tokens, in locations where anyone with View Setup and Configuration permission can get at them. Named Credentials makes that security problem go away.

Put shortly, they abstract away a lot of complex, difficult, and risky (from a security standpoint) implementation details so that your code doesn't have to handle them, and they improve the maintainability and security of your outbound connections.

>>> https://help.salesforce.com/articleView?id=named_credentials_about.htm&type=0

========

Please re-verify the below details.

>> the endpoint URL. (As it was working before with old URL)

>> Steps to create the connection. (If anything has broken referencing the endpoint URL)

++++ https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_named_credentials.htm

>> OAUTH_APPROVAL_ERROR_GENERIC --- please try with the API and refresh_token scopes to the connected app. Or this might be due to the misconfiguration of the connected app.

>> Please try clearing the cache and replicate the same.


And for further reference check here (https://salesforce.stackexchange.com/questions/99900/oauth-issue-oauth-approval-error-generic)


I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.