Skip to content

Commit 3b05f94

Browse files
committed
app reg refactor + code fixes
1 parent 7b26c65 commit 3b05f94

File tree

2 files changed

+57
-55
lines changed

2 files changed

+57
-55
lines changed

articles/active-directory/develop/scenario-spa-app-registration.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ To register a single-page application (SPA) in the Microsoft identity platform,
2323

2424
For both MSAL.js 1.0- and 2.0-based applications, start by completing the following steps to create the initial app registration.
2525

26-
1. Sign in to the [Azure portal](https://portal.azure.com). If your account has access to multiple tenants, select the **Directory + Subscription** filter in the top menu, and then select the tenant to contain the app registration you're about to create.
26+
1. Sign in to the [Azure portal](https://portal.azure.com). If your account has access to multiple tenants, select the **Directory + Subscription** filter in the top menu, and then select the tenant that should contain the app registration you're about to create.
2727
1. Search for and select **Azure Active Directory**.
2828
1. Under **Manage**, select **App registrations**.
29-
1. Select **New registration**, enter a **Name** for the application, and choose the **Supported account types** for the application. Do **NOT** enter a **Redirect URI**. For a description of the different account types, see the [Register a new application using the Azure portal](quickstart-register-app.md#register-a-new-application-using-the-azure-portal).
29+
1. Select **New registration**, enter a **Name** for the application and choose the **Supported account types** for the application. Do **NOT** enter a **Redirect URI**. For a description of the different account types, see the [Register a new application using the Azure portal](quickstart-register-app.md#register-a-new-application-using-the-azure-portal).
3030
1. Select **Register** to create the app registration.
31-
1. Under **Manage**, select **Authentication**, and then select **Add a platform**.
32-
1. Under **Web applications**, select **Single-page application**.
3331

3432
Next, configure the app registration with a **Redirect URI** to specify where the Microsoft identity platform should redirect the client along with any security tokens. Use the steps appropriate for the version of MSAL.js you're using in your application:
3533

@@ -38,32 +36,38 @@ Next, configure the app registration with a **Redirect URI** to specify where th
3836

3937
## Redirect URI: MSAL.js 2.0 with auth code flow
4038

41-
Follow these steps to add a redirect URI for an app that uses MSAL.js 2.0 or later. MSAL.js versions 2.0 and later support the authorization code flow with PKCE and CORS in response to [browser third party cookie restrictions](reference-third-party-cookies-spas.md) (the implicit grant flow is not supported).
39+
Follow these steps to add a redirect URI for an app that uses MSAL.js 2.0 or later. MSAL.js 2.0+ supports the authorization code flow with PKCE and CORS in response to [browser third party cookie restrictions](reference-third-party-cookies-spas.md). The implicit grant flow is not supported in MSAL.js 2.0+.
4240

41+
1. In the Azure portal, select the app registration you created earlier in [Create the app registration](#create-the-app-registration).
42+
1. Under **Manage**, select **Authentication**, and then select **Add a platform**.
43+
1. Under **Web applications**, select **Single-page application**.
4344
1. Under **Redirect URIs**, enter a [redirect URI](reply-url.md). Do **NOT** select either checkbox under **Implicit grant**.
4445
1. Select **Configure** to finish adding the redirect URI.
4546

46-
You've now completed the registration of your single-page application (SPA) and a redirect URI to which the client will be redirected and any security tokens will be sent. By not selecting either of the settings under **Implicit grant**, your application registration is configured to support the authorization code flow with PKCE and CORS.
47+
You've now completed the registration of your single-page application (SPA) and configured a redirect URI to which the client will be redirected and any security tokens will be sent. By not selecting either of the settings under **Implicit grant**, your application registration is configured to support the authorization code flow with PKCE and CORS.
4748

4849
## Redirect URI: MSAL.js 1.0 with implicit flow
4950

5051
Follow these steps to add a redirect URI for a single-page app that uses MSAL.js 1.3 or earlier and the implicit grant flow. Applications that use MSAL.js 1.3 or earlier do not support the auth code flow.
5152

53+
1. In the Azure portal, select the app registration you created earlier in [Create the app registration](#create-the-app-registration).
54+
1. Under **Manage**, select **Authentication**, and then select **Add a platform**.
55+
1. Under **Web applications**, select **Single-page application**.
5256
1. Under **Redirect URIs**, enter a [redirect URI](reply-url.md).
5357
1. Enable the **Implicit flow**:
5458
- If your application signs in users, select **ID tokens**.
5559
- If your application also needs to call a protected web API, select **Access tokens**. For more information about these token types, see [ID tokens](id-tokens.md) and [Access tokens](access-tokens.md).
5660
1. Select **Configure** to finish adding the redirect URI.
5761

58-
You've now completed the registration of your single-page application (SPA) and a redirect URI to which the client will be redirected and any security tokens will be sent. By selecting one or both of **ID tokens** and **Access tokens**, you've enabled the implicit grant flow.
62+
You've now completed the registration of your single-page application (SPA) and configured a redirect URI to which the client will be redirected and any security tokens will be sent. By selecting one or both of **ID tokens** and **Access tokens**, you've enabled the implicit grant flow.
5963

6064
## Note about authorization flows
6165

62-
By default, a new app registration created by using single-page application platform setting enables the authorization code flow. To take advantage of this flow, your application must use MSAL.js 2.0 or later.
66+
By default, an app registration created by using single-page application platform configuration enables the authorization code flow. To take advantage of this flow, your application must use MSAL.js 2.0 or later.
6367

64-
Single-page applications using MSAL.js 1.3 or earlier can use *only* the implicit flow. Current [OAuth 2.0 best practices](v2-oauth2-auth-code-flow.md) recommend using the authorization code flow rather than implicit flow for SPAs. Having limited-lifetime refresh tokens also helps your application adapt to [modern browser cookie privacy limitations](reference-third-party-cookies-spas.md), like Safari ITP.
68+
As mentioned previously, single-page applications using MSAL.js 1.3 are restricted to the implicit grant flow. Current [OAuth 2.0 best practices](v2-oauth2-auth-code-flow.md) recommend using the authorization code flow rather than the implicit flow for SPAs. Having limited-lifetime refresh tokens also helps your application adapt to [modern browser cookie privacy limitations](reference-third-party-cookies-spas.md), like Safari ITP.
6569

66-
When all of your production applications represented by an app registration are using MSAL.js 2.0 and the authorization code flow, uncheck the implicit settings in its **Authentication** pane in the Azure portal. Applications using MSAL.js 1.0 and the implicit flow can continue to function, however, if you leave the implicit flow enabled (checked).
70+
When all of your production applications represented by an app registration are using MSAL.js 2.0 and the authorization code flow, uncheck the implicit grant settings in its **Authentication** pane in the Azure portal. Applications using MSAL.js 1.x and the implicit flow can continue to function, however, if you leave the implicit flow enabled (checked).
6771

6872
## Next steps
6973

0 commit comments

Comments
 (0)