Skip to content

Commit 4d06f5f

Browse files
authored
Add error handling info to page.
1 parent 1885d16 commit 4d06f5f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

articles/active-directory/develop/reference-aadsts-error-codes.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,49 @@ Looking for info about the AADSTS error codes that are returned from the Azure A
2424
>
2525
> This documentation is provided for developer and admin guidance, but should never be used by the client itself. Error codes are subject to change at any time in order to provide more granular error messages that are intended to help the developer while building their application. Apps that take a dependency on text or error code numbers will be broken over time.
2626
27+
## Handling error codes in your application
28+
29+
The [OAuth2.0 spec](https://tools.ietf.org/html/rfc6749#section-5.2) provides guidance on how to handle errors during authentication using the `error` portion of the error response.
30+
31+
Error responses will look like:
32+
33+
```json
34+
{
35+
"error": "invalid_scope",
36+
"error_description": "AADSTS70011: The provided value for the input parameter 'scope' is not valid. The scope https://foo.microsoft.com/mail.read is not valid.\r\nTrace ID: 255d1aef-8c98-452f-ac51-23d051240864\r\nCorrelation ID: fb3d2015-bc17-4bb9-bb85-30c5cf1aaaa7\r\nTimestamp: 2016-01-09 02:02:12Z",
37+
"error_codes": [
38+
70011
39+
],
40+
"timestamp": "2016-01-09 02:02:12Z",
41+
"trace_id": "255d1aef-8c98-452f-ac51-23d051240864",
42+
"correlation_id": "fb3d2015-bc17-4bb9-bb85-30c5cf1aaaa7",
43+
"error_uri":"https://login.microsoftonline.com/error?code=70011"
44+
}
45+
```
46+
47+
| Parameter | Description |
48+
|-------------------|----------------|
49+
| `error` | An error code string that can be used to classify types of errors that occur, and should be used to react to errors. |
50+
| `error_description` | A specific error message that can help a developer identify the root cause of an authentication error. Should never be used by your code to react to an error. |
51+
| `error_codes` | A list of STS-specific error codes that can help in diagnostics. |
52+
| `timestamp` | The time at which the error occurred. |
53+
| `trace_id` | A unique identifier for the request that can help in diagnostics. |
54+
| `correlation_id` | A unique identifier for the request that can help in diagnostics across components. |
55+
| `error_uri` | A link to the error lookup page with additional information about the error. This is for developer usage only, do not present it to users. Only present when the error lookup system has additional information about the error - not all error have additional information provided.|
56+
57+
The `error` field has several possible values - review the protocol documentation links to learn more about specific errors (e.g. `authorization_pending` for the [device code flow](v2-oauth2-device-code.md)) and how to react to them. Some common ones are listed here:
58+
59+
| Error Code | Description | Client Action |
60+
|--------------------|--------------------|------------------|
61+
| `invalid_request` | Protocol error, such as a missing required parameter. | Fix and resubmit the request.|
62+
| `invalid_grant` | Some of the authentication material (auth code, refresh token, access token, PKCE challenge) was invalid, unparseable, missing, or otherwise unuseable | Try a new request to the `/authorize` endpoint to get a new authorization code. Consider reviewing and validating that app's use of the protocols. |
63+
| `unauthorized_client` | The authenticated client isn't authorized to use this authorization grant type. | This usually occurs when the client application isn't registered in Azure AD or isn't added to the user's Azure AD tenant. The application can prompt the user with instruction for installing the application and adding it to Azure AD. |
64+
| `invalid_client` | Client authentication failed. | The client credentials aren't valid. To fix, the application administrator updates the credentials. |
65+
| `unsupported_grant_type` | The authorization server does not support the authorization grant type. | Change the grant type in the request. This type of error should occur only during development and be detected during initial testing. |
66+
| `invalid_resource` | The target resource is invalid because it does not exist, Azure AD can't find it, or it's not correctly configured. | This indicates the resource, if it exists, has not been configured in the tenant. The application can prompt the user with instruction for installing the application and adding it to Azure AD. During development, this usually indicates an incorrectly setup test tenant or a typo in the name of the scope being requested. |
67+
| `interaction_required` | The request requires user interaction. For example, an additional authentication step is required. | Retry the request with the same resource, interactievly, so that the user can complete any challenges required. |
68+
| `temporarily_unavailable` | The server is temporarily too busy to handle the request. | Retry the request. The client application might explain to the user that its response is delayed because of a temporary condition. |
69+
2770
## Lookup current error code information
2871
Error codes and messages are subject to change. For the most current info, take a look at the `https://login.microsoftonline.com/error` page to find AADSTS error descriptions, fixes, and some suggested workarounds.
2972

0 commit comments

Comments
 (0)