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/scenario-spa-app-registration.md
+14-10Lines changed: 14 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,13 +23,11 @@ To register a single-page application (SPA) in the Microsoft identity platform,
23
23
24
24
For both MSAL.js 1.0- and 2.0-based applications, start by completing the following steps to create the initial app registration.
25
25
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.
27
27
1. Search for and select **Azure Active Directory**.
28
28
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).
30
30
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**.
33
31
34
32
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:
35
33
@@ -38,32 +36,38 @@ Next, configure the app registration with a **Redirect URI** to specify where th
38
36
39
37
## Redirect URI: MSAL.js 2.0 with auth code flow
40
38
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+.
42
40
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**.
43
44
1. Under **Redirect URIs**, enter a [redirect URI](reply-url.md). Do **NOT** select either checkbox under **Implicit grant**.
44
45
1. Select **Configure** to finish adding the redirect URI.
45
46
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.
47
48
48
49
## Redirect URI: MSAL.js 1.0 with implicit flow
49
50
50
51
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.
51
52
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**.
52
56
1. Under **Redirect URIs**, enter a [redirect URI](reply-url.md).
53
57
1. Enable the **Implicit flow**:
54
58
- If your application signs in users, select **ID tokens**.
55
59
- 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).
56
60
1. Select **Configure** to finish adding the redirect URI.
57
61
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.
59
63
60
64
## Note about authorization flows
61
65
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.
63
67
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.
65
69
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).
0 commit comments