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/msal-authentication-flows.md
+27-6Lines changed: 27 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.devlang: na
13
13
ms.topic: conceptual
14
14
ms.tgt_pltfrm: na
15
15
ms.workload: identity
16
-
ms.date: 04/25/2019
16
+
ms.date: 10/16/2019
17
17
ms.author: twhitney
18
18
ms.reviewer: saeeda
19
19
ms.custom: aaddev
@@ -34,9 +34,26 @@ This article describes the different authentication flows provided by Microsoft
34
34
|[Client credentials](#client-credentials)| Allows you to access web-hosted resources by using the identity of an application. Commonly used for server-to-server interactions that must run in the background, without immediate interaction with a user. |[Daemon apps](scenario-daemon-overview.md)|
35
35
|[Device code](#device-code)| Allows users to sign in to input-constrained devices such as a smart TV, IoT device, or printer. |[Desktop/mobile apps](scenario-desktop-acquire-token.md#command-line-tool-without-web-browser)|
36
36
|[Integrated Windows Authentication](scenario-desktop-acquire-token.md#integrated-windows-authentication)| Allows applications on domain or Azure Active Directory (Azure AD) joined computers to acquire a token silently (without any UI interaction from the user).|[Desktop/mobile apps](scenario-desktop-acquire-token.md#integrated-windows-authentication)|
37
-
|[Username/password](scenario-desktop-acquire-token.md#username--password)| Allows an application to sign in the user by directly handling their password. This flow isn't recommended. |[Desktop/mobile apps](scenario-desktop-acquire-token.md#username--password)|
37
+
|[Username/password](scenario-desktop-acquire-token.md#username--password)| Allows an application to sign in the user by directly handling their password. This flow isn't recommended. |[Desktop/mobile apps](scenario-desktop-acquire-token.md#username--password)|
38
+
39
+
## How each flow emits tokens and codes
40
+
41
+
Depending on how your client is built, it can use one (or several) of the authentication flows supported by the Microsoft identity platform. These flows can produce a variety of tokens (id_tokens, refresh tokens, access tokens) as well as authorization codes, and require different tokens to make them work. This chart proides an overview:
|[Client credentials](v2-oauth2-client-creds-grant-flow.md)||| x (app-only)|||
52
+
53
+
Tokens issued via the implicit mode have a length limitation due to being passed back to the browser via the URL (where `response_mode` is `query` or `fragment`). Some browsers have a limit on the size of the URL that can be put in the browser bar and fail when it is too long. Thus, these tokens do not have `groups` or `wids` claims.
38
54
39
55
## Interactive
56
+
40
57
MSAL supports the ability to interactively prompt the user for their credentials to sign in, and obtain a token by using those credentials.
41
58
42
59

@@ -59,6 +76,7 @@ Many modern web applications are built as client-side, single page applications,
59
76
This authentication flow doesn't include application scenarios that use cross-platform JavaScript frameworks such as Electron and React-Native, because they require further capabilities for interaction with the native platforms.
60
77
61
78
## Authorization code
79
+
62
80
MSAL supports the [OAuth 2 authorization code grant](v2-oauth2-auth-code-flow.md). This grant can be used in apps that are installed on a device to gain access to protected resources, such as web APIs. This allows you to add sign-in and API access to your mobile and desktop apps.
63
81
64
82
When users sign in to web applications (websites), the web application receives an authorization code. The authorization code is redeemed to acquire a token to call web APIs. In ASP.NET and ASP.NET Core web apps, the only goal of `AcquireTokenByAuthorizationCode` is to add a token to the token cache. The token can then be used by the application (usually in the controllers, which just get a token for an API by using `AcquireTokenSilent`).
@@ -71,6 +89,7 @@ In the preceding diagram, the application:
71
89
2. Uses the access token to call a web API.
72
90
73
91
### Considerations
92
+
74
93
- You can use the authorization code only once to redeem a token. Don't try to acquire a token multiple times with the same authorization code (it's explicitly prohibited by the protocol standard specification). If you redeem the code several times intentionally, or because you are not aware that a framework also does it for you, you'll get the following error: `AADSTS70002: Error validating credentials. AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token.`
75
94
76
95
- If you're writing an ASP.NET or ASP.NET Core application, this might happen if you don't tell the framework that you've already redeemed the authorization code. For this, you need to call the `context.HandleCodeRedemption()` method of the `AuthorizationCodeReceived` event handler.
@@ -101,7 +120,7 @@ The client credentials grant flow permits a web service (a confidential client)
101
120
102
121
MSAL.NET supports two types of client credentials. These client credentials need to be registered with Azure AD. The credentials are passed in to the constructors of the confidential client application in your code.
103
122
104
-
### Application secrets
123
+
### Application secrets
105
124
106
125

107
126
@@ -110,7 +129,7 @@ In the preceding diagram, the application:
110
129
1. Acquires a token by using application secret or password credentials.
111
130
2. Uses the token to make requests of the resource.
112
131
113
-
### Certificates
132
+
### Certificates
114
133
115
134

116
135
@@ -123,8 +142,8 @@ These client credentials need to be:
123
142
- Registered with Azure AD.
124
143
- Passed in at the construction of the confidential client application in your code.
125
144
126
-
127
145
## Device code
146
+
128
147
MSAL supports the [OAuth 2 device code flow](v2-oauth2-device-code.md), which allows users to sign in to input-constrained devices, such as a smart TV, IoT device, or printer. Interactive authentication with Azure AD requires a web browser. The device code flow lets the user use another device (for example, another computer or a mobile phone) to sign in interactively, where the device or operating system doesn't provide a web browser.
129
148
130
149
By using the device code flow, the application obtains tokens through a two-step process especially designed for these devices or operating systems. Examples of such applications include those running on IoT devices or command-line tools (CLI).
@@ -146,6 +165,7 @@ In the preceding diagram:
146
165
- Microsoft personal accounts aren't yet supported by the Azure AD v2.0 endpoint (you can't use the `/common` or `/consumers` tenants).
147
166
148
167
## Integrated Windows Authentication
168
+
149
169
MSAL supports Integrated Windows Authentication (IWA) for desktop or mobile applications that run on a domain joined or Azure AD joined Windows computer. Using IWA, these applications can acquire a token silently (without any UI interaction from the user).
150
170
151
171

@@ -183,7 +203,8 @@ The IWA flow is enabled for .NET desktop, .NET Core, and Windows Universal Platf
183
203
184
204
For more information on consent, see [v2.0 permissions and consent](v2-permissions-and-consent.md).
185
205
186
-
## Username/password
206
+
## Username/password
207
+
187
208
MSAL supports the [OAuth 2 resource owner password credentials grant](v2-oauth-ropc.md), which allows an application to sign in the user by directly handling their password. In your desktop application, you can use the username/password flow to acquire a token silently. No UI is required when using the application.
188
209
189
210

0 commit comments