You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/active-directory/develop/userinfo.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,15 @@ ms.service: active-directory
9
9
ms.subservice: develop
10
10
ms.workload: identity
11
11
ms.topic: conceptual
12
-
ms.date: 09/21/2020
12
+
ms.date: 08/26/2022
13
13
ms.author: ludwignick
14
14
ms.reviewer: ludwignick
15
15
ms.custom: aaddev
16
16
---
17
17
18
18
# Microsoft identity platform UserInfo endpoint
19
19
20
-
The UserInfo endpoint is part of the [OpenID Connect standard](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo)(OIDC), designed to return claims about the user that authenticated. For the Microsoft identity platform, the UserInfo endpoint is hosted on Microsoft Graph (https://graph.microsoft.com/oidc/userinfo).
20
+
Part of the OpenID Connect (OIDC) standard, the [UserInfo endpoint](https://openid.net/specs/openid-connect-core-1_0.html#UserInfo)is designed to return information (claims) about an authenticated user. In the Microsoft identity platform, the UserInfo endpoint is provided by Microsoft Graph at https://graph.microsoft.com/oidc/userinfo.
Copy file name to clipboardExpand all lines: articles/active-directory/develop/v2-protocols-oidc.md
+36-43Lines changed: 36 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,43 +1,43 @@
1
1
---
2
-
title: Microsoft identity platform and OpenID Connect protocol
3
-
description: Build web applications by using the Microsoft identity platform implementation of the OpenID Connect authentication protocol.
4
-
services: active-directory
2
+
title: OpenID Connect (OIDC) on the Microsoft identity platform
3
+
description: Sign in Azure AD users by using the Microsoft identity platform's implementation of the OpenID Connect extension to OAuth 2.0.
5
4
author: nickludwig
6
5
manager: CelesteDG
7
-
8
-
ms.service: active-directory
9
-
ms.subservice: develop
10
-
ms.workload: identity
11
-
ms.topic: conceptual
12
-
ms.date: 07/19/2021
13
6
ms.author: ludwignick
14
-
ms.reviewer: ludwignick
15
7
ms.custom: aaddev, identityplatformtop40
8
+
ms.date: 08/26/2022
9
+
ms.reviewer: ludwignick
10
+
ms.service: active-directory
11
+
ms.subservice: develop
12
+
ms.topic: reference
16
13
---
17
14
18
-
# Microsoft identity platform and OpenID Connect protocol
15
+
# OpenID Connect on the Microsoft identity platform
19
16
20
-
OpenID Connect (OIDC) is an authentication protocol built on OAuth 2.0 that you can use to securely sign in a user to an application. When you use the Microsoft identity platform's implementation of OpenID Connect, you can add sign-in and API access to your apps. This article shows how to do this independent of language and describes how to send and receive HTTP messages without using any [Microsoft open-source libraries](reference-v2-libraries.md).
17
+
OpenID Connect (OIDC) extends the OAuth 2.0 authorization protocol for use also as an authentication protocol. You can use OIDC to enable single sign-on (SSO) between your OAuth-enabled applications.
21
18
22
-
[OpenID Connect](https://openid.net/specs/openid-connect-core-1_0.html) extends the OAuth 2.0 *authorization* protocol for use as an *authentication* protocol, so that you can do single sign-on using OAuth. OpenID Connect introduces the concept of an *ID token*, which is a security token that allows the client to verify the identity of the user. The ID token also gets basic profile information about the user. It also introduces the [UserInfo endpoint](userinfo.md), an API that returns information about the user.
19
+
OpenID Connect introduces a type of security token called an *ID token*that allows the client application to verify the identity of a user. The ID token includes information (claims) about an authenticated user, and the user's information is also made available at the OIDC [UserInfo endpoint](userinfo.md).
The full OIDC specification is available on the OpenID Foundation's website at [OpenID Connect Core 1.0 specification](https://openid.net/specs/openid-connect-core-1_0.html).
25
22
26
-
## Protocol diagram: Sign-in
23
+
## Protocol flow: Sign-in
27
24
28
-
The most basic sign-in flow has the steps shown in the next diagram. Each step is described in detail in this article.
25
+
This diagram shows the basic OpenID Connect sign-in flow. The steps in the flow are described in detail in the sections that follow.

31
30
32
-
## Fetch the OpenID Connect metadata document
31
+
## Requesting the OpenID Connect discovery document
33
32
34
-
OpenID Connect describes a metadata document [(RFC)](https://openid.net/specs/openid-connect-discovery-1_0.html)that contains most of the information required for an app to do sign in. This includes information such as the URLs to use and the location of the service's public signing keys. You can find this document by appending the discovery document path to the authority URL:
33
+
OpenID Connect also provides and endpoint for the [discovery of OIDC metadata](https://openid.net/specs/openid-connect-discovery-1_0.html)for a service. Client applications can use the information in metadata document to find URLs to use for authentication and the authentication service's public signing keys. Most often, an authentication library you use in your app uses the OpenID Connect discovery document without requiring your hand-coding these details into your application.
Every app registration in Azure AD includes publicly accessible OIDC discovery documents. To determine the URL your app can use to get most of the information it needs to sign in users, append the _discovery document path_ to your app registration's _authority URL_.
The value of `{tenant}`varies based on the application's sign-in audience as shown in the following table. The authority URL also varies by [cloud instance](authentication-national-cloud.md#azure-ad-authentication-endpoints).
41
41
42
42
| Value | Description |
43
43
| --- | --- |
@@ -46,14 +46,12 @@ The `{tenant}` can take one of four values:
46
46
|`consumers`|Only users with a personal Microsoft account can sign in to the application. |
47
47
|`8eaef023-2b34-4da1-9baa-8bc8c9d6a490` or `contoso.onmicrosoft.com`| Only users from a specific Azure AD tenant (whether they are members in the directory with a work or school account, or they are guests in the directory with a personal Microsoft account) can sign in to the application. Either the friendly domain name of the Azure AD tenant or the tenant's GUID identifier can be used. You can also use the consumer tenant, `9188040d-6c67-4c5b-b112-36a304b66dad`, in place of the `consumers` tenant. |
48
48
49
-
The authority differs across national clouds - e.g. `https://login.microsoftonline.de` for the Azure AD Germany instance. If you do not use the public cloud, please review the [national cloud endpoints](authentication-national-cloud.md#azure-ad-authentication-endpoints) to find the appropriate one for you. Ensure that the tenant and `/v2.0/` are present in your request so you can use the v2.0 version of the endpoint.
50
-
51
49
> [!TIP]
52
-
> Try it! Click[https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration](https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration) to see the `common` configuration.
50
+
> Try it! Select[https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration](https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration) to see the OIDC discovery document for the `common` configuration.
53
51
54
52
### Sample request
55
53
56
-
To call the userinfo endpoint for the common authority on the public cloud, use the following:
54
+
To call the UserInfo endpoint for the `common` authority on the Azure public cloud:
57
55
58
56
```http
59
57
GET /common/v2.0/.well-known/openid-configuration
@@ -62,7 +60,7 @@ Host: login.microsoftonline.com
62
60
63
61
### Sample response
64
62
65
-
The metadata is a simple JavaScript Object Notation (JSON) document. See the following snippet for an example. The contents are fully described in the [OpenID Connect specification](https://openid.net/specs/openid-connect-discovery-1_0.html#rfc.section.4.2).
63
+
The metadata is returned in JSON format as shown in following example (truncated for brevity). The contents of the JSON response are described fully in the [OpenID Connect 1.0 discovery specification](https://openid.net/specs/openid-connect-discovery-1_0.html#rfc.section.4.2).
66
64
67
65
```json
68
66
{
@@ -78,30 +76,25 @@ The metadata is a simple JavaScript Object Notation (JSON) document. See the fol
78
76
"pairwise"
79
77
],
80
78
...
81
-
82
79
}
83
80
```
84
81
85
-
If your app has custom signing keys as a result of using the [claims-mapping](active-directory-claims-mapping.md) feature, you must append an `appid` query parameter containing the app ID in order to get a `jwks_uri` pointing to your app's signing key information. For example: `https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration?appid=6731de76-14a6-49ae-97bc-6eba6914391e` contains a `jwks_uri` of `https://login.microsoftonline.com/{tenant}/discovery/v2.0/keys?appid=6731de76-14a6-49ae-97bc-6eba6914391e`.
86
-
87
-
Typically, you would use this metadata document to configure an OpenID Connect library or SDK; the library would use the metadata to do its work. However, if you're not using a pre-built OpenID Connect library, you can follow the steps in the remainder of this article to do sign-in in a web app by using the Microsoft identity platform.
82
+
<!-- UNCOMMENT WHEN/IF THE EXAMPLE APP REGISTRATION IS RE-ENABLED -->
83
+
<!-- If your app has custom signing keys as a result of using [claims mapping](active-directory-claims-mapping.md), append the `appid` query parameter to include the `jwks_uri` claim that includes your app's signing key information. For example, `https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration?appid=6731de76-14a6-49ae-97bc-6eba6914391e` includes a `jwks_uri` of `https://login.microsoftonline.com/{tenant}/discovery/v2.0/keys?appid=6731de76-14a6-49ae-97bc-6eba6914391e`. -->
88
84
89
85
## Send the sign-in request
90
86
91
-
When your web app needs to authenticate the user, it can direct the user to the `/authorize` endpoint. This request is similar to the first leg of the [OAuth 2.0 authorization code flow](v2-oauth2-auth-code-flow.md), with these important distinctions:
87
+
To authenticate the user in your web application, direct the their user-agent to the `/authorize` endpoint. The request is similar to the first leg of the [OAuth 2.0 authorization code flow](v2-oauth2-auth-code-flow.md), with these important distinctions:
92
88
93
89
* The request must include the `openid` scope in the `scope` parameter.
94
90
* The `response_type` parameter must include `id_token`.
95
91
* The request must include the `nonce` parameter.
92
+
* Select the **ID tokens (used for implicit and hybrid flows)** checkbox under **Implicit grant and hybrid flows** in **Azure Active Directory** > **App registrations** > \<your application\>**Authentication** in the Azure portal.
93
+
* Checking the ID tokens checkbox sets `oauth2AllowIdTokenImplicitFlow` to `true` in the [application manifest](reference-app-manifest.md). If you fail to select the ID tokens checkbox, an `unsupported_response` error is returned similar to: "The provided value for the input parameter 'response_type' isn't allowed for this client. Expected value is 'code'".
96
94
97
-
> [!IMPORTANT]
98
-
> In order to successfully request an ID token from the /authorization endpoint, the app registration in the [registration portal](https://portal.azure.com) must have the implicit grant of id_tokens enabled in the Authentication tab (which sets the `oauth2AllowIdTokenImplicitFlow` flag in the [application manifest](reference-app-manifest.md) to `true`). If it isn't enabled, an `unsupported_response` error will be returned: "The provided value for the input parameter 'response_type' isn't allowed for this client. Expected value is 'code'"
99
-
100
-
For example:
95
+
Example request (line breaks are included for readability only):
101
96
102
97
```HTTP
103
-
// Line breaks are for legibility only.
104
-
105
98
GET https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
106
99
client_id=6731de76-14a6-49ae-97bc-6eba6914391e
107
100
&response_type=id_token
@@ -132,7 +125,7 @@ After the user authenticates and grants consent, the Microsoft identity platform
132
125
133
126
### Successful response
134
127
135
-
A successful response when you use `response_mode=form_post` looks like this:
128
+
A successful response when you use `response_mode=form_post`:
Error responses might also be sent to the redirect URI so that the app can handle them. An error response looks like this:
145
+
Error responses might also be sent to the redirect URI so the app can handle them:
153
146
154
147
```HTTP
155
148
POST /myapp/ HTTP/1.1
@@ -180,7 +173,7 @@ The following table describes error codes that can be returned in the `error` pa
180
173
181
174
## Validate the ID token
182
175
183
-
Just receiving an id_token isn't always sufficient to authenticate the user; you may also need to validate the id_token's signature and verify the claims in the token per your app's requirements. Like all OIDC platforms, the Microsoft identity platform uses [JSON Web Tokens (JWTs)](https://tools.ietf.org/html/rfc7519) and public key cryptography to sign ID tokens and verify that they're valid.
176
+
Merely receiving an ID token isn't always sufficient to authenticate the user; you may also need to validate the ID token's signature and verify its claims per your app's requirements. Like all OIDC platforms, the Microsoft identity platform uses [JSON Web Tokens (JWTs)](https://tools.ietf.org/html/rfc7519) and public key cryptography to sign ID tokens and verify they're valid.
184
177
185
178
Not all apps benefit from verifying the ID token - native apps and single page apps, for instance, rarely benefit from validating the ID token. Someone with physical access to the device (or browser) can bypass the validation in many ways - from editing the web traffic to the device to provide fake tokens and keys to simply debugging the application to skip the validation logic. On the other hand, web apps and APIs using an ID token to authorization must validate the ID token carefully since they are gating access to data.
186
179
@@ -227,7 +220,7 @@ You can also use the [authorization code flow](v2-oauth2-auth-code-flow.md), the
227
220
228
221
### Successful token response
229
222
230
-
A successful response from using `response_mode=form_post` looks like this:
223
+
A successful response from using `response_mode=form_post`:
231
224
232
225
```HTTP
233
226
POST /myapp/ HTTP/1.1
@@ -256,7 +249,7 @@ Response parameters mean the same thing regardless of the flow used to acquire t
256
249
257
250
### Error response
258
251
259
-
Error responses might also be sent to the redirect URI so that the app can handle them appropriately. An error response looks like this:
252
+
Error responses might also be sent to the redirect URI so that the app can handle them appropriately:
0 commit comments