OAuth 2.0 Authorization Errors
Errors can occur during OAuth authorization. For example, a user denies access to the connected app or request parameters are incorrect. When errors occur, the authorizing server sends an error to the callback URL with an error code.
Required Editions
| Available in: both Salesforce Classic and Lightning Experience |
| Available in: All Editions |
OAuth authorization errors have different formats depending on the authorization flow. Here are examples from each of the supported OAuth flows.
- This error is from an OAuth 2.0 web server flow, in which the user denied access to the
connected app:
https://www.mycustomerorderstatus/code_callback.jsp?error=access-denied - Here’s the same error from an OAuth 2.0 user-agent
flow:
https://www.customercontactinfo.com/user_callback.jsp#error=access_denied - If an error occurs in the OAuth 2.0 JWT bearer flow, the authorizing server replies with a standard OAuth error response. The response
includes the reasons why the token is considered invalid. For more information, see
https://tools.ietf.org/html/rfc7523. This
example shows a sample error response in JSON
format.
HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store { "error":"invalid_grant", "error_description":"Audience validation failed" } - The following is an example of a returned error from an OAuth 2.0 refresh token
flow.
{"error":"invalid_grant","error_description":"expired access/refresh token"} - This sample error response occurred while processing the SAML bearer
assertion.
HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store { "error":"invalid_grant", "error_description":"Audience validation failed" } -
Here’s an example error from a SAML assertion flow. This flow includes an error URI, which is a link to the SAML Assertion Validator. The validator contains more information about the failure. The error URI is returned only when Salesforce can parse the assertion.
{"error_uri":"https://yourInstance.salesforce.com/setup/secur/SAMLValidationPage.apexp", "error":"invalid_grant","error_description":"invalid assertion"}
Error Codes
To help troubleshoot why an error occurred, review the following error codes and causes.
| Error | Cause |
|---|---|
access_denied
|
User denied access to the client app. |
authorization_pending
|
For the device flow, the user hasn’t approved the device for access yet. |
CSRF
|
Salesforce detected a possible Cross-Site Forgery Request (CSRF) attack. We couldn't verify that the request to log in came from the correct domain. |
ERROR_CREATING_USER
|
One of these scenarios has occurred.
|
immediate_unsuccessful
|
The immediate parameter is set to true, and the user isn’t logged in or hasn’t
previously approved the client’s access. |
inactive_org
|
Org is locked, closed, or suspended. |
inactive_user
|
User is set to inactive by the org’s admin. |
invalid_app_access
|
User isn’t approved by an admin to access this app. |
invalid_assertion_type
|
Specified assertion type isn’t supported. |
invalid_client
|
Client secret is invalid. |
invalid_client_id
|
Client identifier is invalid. |
invalid_grant
|
One of the following:
|
invalid_request
|
One of the following errors.
|
invalid_scope
|
The requested scope is invalid, unknown, or malformed. |
NO_ACCESS
|
Unable to find a user. For example, there's no username. |
No_OAuth_State
|
The OAuth state was tampered with or is missing. |
No_Openid_Response
|
User Info Endpoint URL is invalid. |
rate_limit_exceeded
|
Number of login attempts has been exceeded. |
redirect_uri_mismatch
|
Redirect URI mismatch with connected app definition. |
redirect_uri_missing
|
Redirect URI not provided. |
REGISTRATION_HANDLER_ERROR
|
For authentication providers, there's a problem with your registration handler Apex code. |
server_error
|
The number of authorization requests from the client app exceeds the hourly limit. |
slow_down
|
For the device flow, the client app is polling the authorization server more frequently than the recommended minimum interval. |
unsupported_response_type
|
Requested response type isn’t supported. |

