Skip to content

Commit ca281f4

Browse files
authored
Merge pull request #294737 from kengaderdus/freshness-feb-2025
Keep our content fresh
2 parents 0a2aaf2 + 7e84b80 commit ca281f4

11 files changed

+73
-76
lines changed

articles/active-directory-b2c/access-tokens.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: CelesteDG
88
ms.service: azure-active-directory
99

1010
ms.topic: concept-article
11-
ms.date: 01/11/2024
11+
ms.date: 02/17/2025
1212
ms.author: kengaderdus
1313
ms.subservice: b2c
1414

articles/active-directory-b2c/authorization-code-flow.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: Authorization code flow - Azure Active Directory B2C
3-
description: Learn how to build web apps by using Azure AD B2C and OpenID Connect authentication protocol.
3+
description: Learn how to implement OAuth 2.0 authorization code flow in Azure AD B2C for web, mobile, and desktop apps, including setup and HTTP request examples.
44
author: kengaderdus
55
manager: CelesteDG
66
ms.service: azure-active-directory
77
ms.topic: concept-article
8-
ms.date: 01/11/2024
8+
ms.date: 02/17/2025
99
ms.author: kengaderdus
1010
ms.subservice: b2c
1111
ms.custom: fasttrack-edit
@@ -21,7 +21,7 @@ You can use the OAuth 2.0 authorization code grant in apps installed on a device
2121

2222
The OAuth 2.0 authorization code flow is described in [section 4.1 of the OAuth 2.0 specification](https://tools.ietf.org/html/rfc6749). You can use it for authentication and authorization in most [application types](application-types.md), including web applications, single-page applications, and natively installed applications. You can use the OAuth 2.0 authorization code flow to securely acquire access tokens and refresh tokens for your applications, which can be used to access resources that are secured by an [authorization server](protocols-overview.md). The refresh token allows the client to acquire new access (and refresh) tokens once the access token expires, typically after one hour.
2323

24-
This article focuses on the **public clients** OAuth 2.0 authorization code flow. A public client is any client application that cannot be trusted to securely maintain the integrity of a secret password. This includes single-page applications, mobile apps, desktop applications, and essentially any application that doesn't run on a server.
24+
This article focuses on the **public clients** OAuth 2.0 authorization code flow. A public client is any client application that can't be trusted to securely maintain the integrity of a secret password. This includes single-page applications, mobile apps, desktop applications, and essentially any application that doesn't run on a server.
2525

2626
> [!NOTE]
2727
> To add identity management to a web app by using Azure AD B2C, use [OpenID Connect](openid-connect.md) instead of OAuth 2.0.
@@ -63,13 +63,13 @@ client_id=00001111-aaaa-2222-bbbb-3333cccc4444
6363
| client_id |Required |The application ID assigned to your app in the [Azure portal](https://portal.azure.com). |
6464
| response_type |Required |The response type, which must include `code` for the authorization code flow. You can receive an ID token if you include it in the response type, such as `code+id_token`, and in this case, the scope needs to include `openid`.|
6565
| redirect_uri |Required |The redirect URI of your app, where authentication responses are sent and received by your app. It must exactly match one of the redirect URIs that you registered in the portal, except that it must be URL-encoded. |
66-
| scope |Required |A space-separated list of scopes. The `openid` scope indicates a permission to sign in the user and get data about the user in the form of ID tokens. The `offline_access` scope is optional for web applications. It indicates that your application will need a *refresh token* for extended access to resources. The client-id indicates the token issued are intended for use by Azure AD B2C registered client. The `https://{tenant-name}/{app-id-uri}/{scope}` indicates a permission to protected resources, such as a web API. For more information, see [Request an access token](access-tokens.md#scopes). |
66+
| scope |Required |A space-separated list of scopes. The `openid` scope indicates a permission to sign in the user and get data about the user in the form of ID tokens. The `offline_access` scope is optional for web applications. It indicates that your application needs a *refresh token* for extended access to resources. The client-id indicates the token issued are intended for use by Azure AD B2C registered client. The `https://{tenant-name}/{app-id-uri}/{scope}` indicates a permission to protected resources, such as a web API. For more information, see [Request an access token](access-tokens.md#scopes). |
6767
| response_mode |Recommended |The method that you use to send the resulting authorization code back to your app. It can be `query`, `form_post`, or `fragment`. |
6868
| state |Recommended |A value included in the request that can be a string of any content that you want to use. Usually, a randomly generated unique value is used, to prevent cross-site request forgery attacks. The state also is used to encode information about the user's state in the app before the authentication request occurred. For example, the page the user was on, or the user flow that was being executed. |
69-
| prompt |Optional |The type of user interaction that is required. Currently, the only valid value is `login`, which forces the user to enter their credentials on that request. Single sign-on will not take effect. |
69+
| prompt |Optional |The type of user interaction that is required. Currently, the only valid value is `login`, which forces the user to enter their credentials on that request. Single sign-on won't take effect. |
7070
| code_challenge | recommended / required | Used to secure authorization code grants via Proof Key for Code Exchange (PKCE). Required if `code_challenge_method` is included. You need to add logic in your application to generate the `code_verifier` and `code_challenge`. The `code_challenge` is a Base64 URL-encoded SHA256 hash of the `code_verifier`. You store the `code_verifier` in your application for later use, and send the `code_challenge` along with the authorization request. For more information, see the [PKCE RFC](https://tools.ietf.org/html/rfc7636). This is now recommended for all application types - native apps, SPAs, and confidential clients like web apps. |
71-
| `code_challenge_method` | recommended / required | The method used to encode the `code_verifier` for the `code_challenge` parameter. This *SHOULD* be `S256`, but the spec allows the use of `plain` if for some reason the client cannot support SHA256. <br/><br/>If you exclude the `code_challenge_method`, but still include the `code_challenge`, then the `code_challenge` is assumed to be plaintext. Microsoft identity platform supports both `plain` and `S256`. For more information, see the [PKCE RFC](https://tools.ietf.org/html/rfc7636). This is required for [single page apps using the authorization code flow](tutorial-register-spa.md).|
72-
| login_hint | No| Can be used to pre-fill the sign-in name field of the sign-in page. For more information, see [Prepopulate the sign-in name](direct-signin.md#prepopulate-the-sign-in-name). |
71+
| `code_challenge_method` | recommended / required | The method used to encode the `code_verifier` for the `code_challenge` parameter. This *SHOULD* be `S256`, but the spec allows the use of `plain` if for some reason the client can't support SHA256. <br/><br/>If you exclude the `code_challenge_method`, but still include the `code_challenge`, then the `code_challenge` is assumed to be plaintext. Microsoft identity platform supports both `plain` and `S256`. For more information, see the [PKCE RFC](https://tools.ietf.org/html/rfc7636). This is required for [single page apps using the authorization code flow](tutorial-register-spa.md).|
72+
| login_hint | No| Can be used to prefill the sign-in name field of the sign-in page. For more information, see [Prepopulate the sign-in name](direct-signin.md#prepopulate-the-sign-in-name). |
7373
| domain_hint | No| Provides a hint to Azure AD B2C about the social identity provider that should be used for sign-in. If a valid value is included, the user goes directly to the identity provider sign-in page. For more information, see [Redirect sign-in to a social provider](direct-signin.md#redirect-sign-in-to-a-social-provider). |
7474
| Custom parameters | No| Custom parameters that can be used with [custom policies](custom-policy-overview.md). For example, [dynamic custom page content URI](customize-ui-with-html.md?pivots=b2c-custom-policy#configure-dynamic-custom-page-content-uri), or [key-value claim resolvers](claim-resolver-overview.md#oauth2-key-value-parameters). |
7575

@@ -87,7 +87,7 @@ code=AwABAAAAvPM1KaPlrEqdFSBzjqfTGBCmLdgfSTLEMPGYuNHSUYBrq... // the auth
8787

8888
| Parameter | Description |
8989
| --- | --- |
90-
| code |The authorization code that the app requested. The app can use the authorization code to request an access token for a target resource. Authorization codes are very short-lived. Typically, they expire after about 10 minutes. |
90+
| code |The authorization code that the app requested. The app can use the authorization code to request an access token for a target resource. Authorization codes are short-lived. Typically, they expire after about 10 minutes. |
9191
| state |See the full description in the table in the preceding section. If a `state` parameter is included in the request, the same value should appear in the response. The app should verify that the `state` values in the request and response are identical. |
9292

9393
Error responses also can be sent to the redirect URI so that the app can handle them appropriately:
@@ -126,9 +126,9 @@ grant_type=authorization_code
126126
| Parameter | Required? | Description |
127127
| --- | --- | --- |
128128
|{tenant}| Required | Name of your Azure AD B2C tenant|
129-
|{policy}| Required| The user flow that was used to acquire the authorization code. You cannot use a different user flow in this request. |
129+
|{policy}| Required| The user flow that was used to acquire the authorization code. You can't use a different user flow in this request. |
130130
| client_id |Required |The application ID assigned to your app in the [Azure portal](https://portal.azure.com).|
131-
| client_secret | Yes, in Web Apps | The application secret that was generated in the [Azure portal](https://portal.azure.com/). Client secrets are used in this flow for Web App scenarios, where the client can securely store a client secret. For Native App (public client) scenarios, client secrets cannot be securely stored, and therefore are not used in this call. If you use a client secret, please change it on a periodic basis. |
131+
| client_secret | Yes, in Web Apps | The application secret that was generated in the [Azure portal](https://portal.azure.com/). Client secrets are used in this flow for Web App scenarios, where the client can securely store a client secret. For Native App (public client) scenarios, client secrets can't be securely stored, and therefore aren't used in this call. If you use a client secret, change it on a periodic basis. |
132132
| grant_type |Required |The type of grant. For the authorization code flow, the grant type must be `authorization_code`. |
133133
| scope |Recommended |A space-separated list of scopes. A single scope value indicates to Azure AD B2C both of the permissions that are being requested. Using the client ID as the scope indicates that your app needs an access token that can be used against your own service or web API, represented by the same client ID. The `offline_access` scope indicates that your app needs a refresh token for long-lived access to resources. You also can use the `openid` scope to request an ID token from Azure AD B2C. |
134134
| code |Required |The authorization code that you acquired in from the `/authorize` endpoint. |
@@ -184,7 +184,7 @@ Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik5HVEZ2ZEstZn
184184

185185
## 4. Refresh the token
186186

187-
Access tokens and ID tokens are short-lived. After they expire, you must refresh them to continue to access resources. When you refresh the access token, Azure AD B2C returns a new token. The refreshed access token will have updated `nbf` (not before), `iat` (issued at), and `exp` (expiration) claim values. All other claim values will be the same as the originally issued access token.
187+
Access tokens and ID tokens are short-lived. After they expire, you must refresh them to continue to access resources. When you refresh the access token, Azure AD B2C returns a new token. The refreshed access token will have updated `nbf` (not before), `iat` (issued at), and `exp` (expiration) claim values. All other claim values are the same as the originally issued access token.
188188

189189

190190
To refresh the token, submit another POST request to the `/token` endpoint. This time, provide the `refresh_token` instead of the `code`:
@@ -204,11 +204,11 @@ grant_type=refresh_token
204204
| Parameter | Required? | Description |
205205
| --- | --- | --- |
206206
|{tenant}| Required | Name of your Azure AD B2C tenant|
207-
|{policy} |Required |The user flow that was used to acquire the original refresh token. You cannot use a different user flow in this request. |
207+
|{policy} |Required |The user flow that was used to acquire the original refresh token. You can't use a different user flow in this request. |
208208
| client_id |Required |The application ID assigned to your app in the [Azure portal](https://portal.azure.com). |
209-
| client_secret | Yes, in Web Apps | The application secret that was generated in the [Azure portal](https://portal.azure.com/). Client secrets are used in this flow for Web App scenarios, where the client can securely store a client secret. For Native App (public client) scenarios, client secrets cannot be securely stored, and therefore are not used in this call. If you use a client secret, please change it on a periodic basis. |
209+
| client_secret | Yes, in Web Apps | The application secret that was generated in the [Azure portal](https://portal.azure.com/). Client secrets are used in this flow for Web App scenarios, where the client can securely store a client secret. For Native App (public client) scenarios, client secrets can't be securely stored, and therefore aren't used in this call. If you use a client secret, please change it on a periodic basis. |
210210
| grant_type |Required |The type of grant. For this leg of the authorization code flow, the grant type must be `refresh_token`. |
211-
| scope |Recommended |A space-separated list of scopes. A single scope value indicates to Microsoft Entra ID both of the permissions that are being requested. Using the client ID as the scope indicates that your app needs an access token that can be used against your own service or web API, represented by the same client ID. The `offline_access` scope indicates that your app will need a refresh token for long-lived access to resources. You also can use the `openid` scope to request an ID token from Azure AD B2C. |
211+
| scope |Recommended |A space-separated list of scopes. A single scope value indicates to Microsoft Entra ID both of the permissions that are being requested. Using the client ID as the scope indicates that your app needs an access token that can be used against your own service or web API, represented by the same client ID. The `offline_access` scope indicates that your app needs a refresh token for long-lived access to resources. You also can use the `openid` scope to request an ID token from Azure AD B2C. |
212212
| redirect_uri |Optional |The redirect URI of the application where you received the authorization code. |
213213
| refresh_token |Required |The original refresh token that you acquired in the second leg of the flow. |
214214

@@ -248,6 +248,7 @@ Error responses look like this:
248248
| error_description |A specific error message that can help you identify the root cause of an authentication error. |
249249

250250
## Use your own Azure AD B2C directory
251+
251252
To try these requests yourself, complete the following steps. Replace the example values we used in this article with your own values.
252253

253254
1. [Create an Azure AD B2C directory](tutorial-create-tenant.md). Use the name of your directory in the requests.

articles/active-directory-b2c/configure-authentication-in-azure-static-app.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
title: Configure authentication in an Azure Static Web App by using Azure Active Directory B2C
2+
title: Configure authentication in an Azure Static Web App by using Azure AD B2C
33
description: This article discusses how to use Azure Active Directory B2C to sign in and sign up users in an Azure Static Web App.
44

55
author: kengaderdus
66
manager: CelesteDG
77
ms.service: azure-active-directory
88

99
ms.topic: reference
10-
ms.date: 01/11/2024
10+
ms.date: 02/17/2025
1111
ms.author: kengaderdus
1212
ms.subservice: b2c
1313
ms.custom: "b2c-support"
@@ -129,8 +129,8 @@ Once you've added the app ID and secret, use the following steps to add the Azur
129129
## Step 4: Check the Azure Static Web APP
130130

131131
1. Navigate to `/.auth/login/aadb2c`. The `/.auth/login` points the Azure Static app login endpoint. The `aadb2c` references to your [OpenID Connect identity provider](#31-add-an-openid-connect-identity-provider). The following URL demonstrates an Azure Static app login endpoint: `https://witty-island-11111111.azurestaticapps.net/.auth/login/aadb2c`.
132-
1. Complete the sign up or sign in process.
133-
1. In your browser debugger, [run the following JavaScript in the Console](/microsoft-edge/devtools-guide-chromium/console/console-javascript). The JavaScript code will present information about the sign in user.
132+
1. Complete the sign-up or sign-in process.
133+
1. In your browser debugger, [run the following JavaScript in the Console](/microsoft-edge/devtools-guide-chromium/console/console-javascript). The JavaScript code presents information about the sign in user.
134134

135135
```javascript
136136
async function getUserInfo() {

articles/active-directory-b2c/configure-tokens.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: kengaderdus
55
manager: CelesteDG
66
ms.service: azure-active-directory
77
ms.topic: how-to
8-
ms.date: 01/11/2024
8+
ms.date: 02/17/2025
99
ms.author: kengaderdus
1010
ms.subservice: b2c
1111
zone_pivot_groups: b2c-policy-type
@@ -233,7 +233,7 @@ The OutputClaim element contains the following attributes:
233233

234234
When using the [OAuth 2.0 authorization code flow](authorization-code-flow.md), the app can use the authorization code to request an access token for a target resource. Authorization codes are short-lived that expire after about 10 minutes. The authorization code lifetime can't be configured. Make sure your application redeems the authorization codes within 10 minutes.
235235

236-
## Next steps
236+
## Related content
237237

238238
- Learn more about how to [request access tokens](access-tokens.md).
239239
- Learn how to build [Resilience through developer best practices](../active-directory/architecture/resilience-b2c-developer-best-practices.md?bc=/azure/active-directory-b2c/bread/toc.json&toc=/azure/active-directory-b2c/TOC.json).

0 commit comments

Comments
 (0)