Skip to content

Commit bd98a44

Browse files
authored
Blazor WASM security NOTE update (#18361)
1 parent d55f4ea commit bd98a44

7 files changed

Lines changed: 20 additions & 74 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
> [!NOTE]
2+
> If the Azure portal provides the scope URI for the app and the app throws an unhandled exception when it receives a *401 Unauthorized* response from the API, try using a scope URI that doesn't include the scheme and host. For example, the Azure portal may provide one of the following scope URI formats:
3+
>
4+
> * `https://{TENANT}.onmicrosoft.com/{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
5+
> * `api://{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
6+
>
7+
> Try supplying the scope URI without the scheme and host:
8+
>
9+
> ```csharp
10+
> options.ProviderOptions.DefaultAccessTokenScopes.Add(
11+
> "{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}");
12+
> ```

aspnetcore/security/blazor/webassembly/hosted-with-azure-active-directory-b2c.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ In **API permissions**:
9191
1. Select **Add permissions**.
9292
1. Select the **Grant admin content for {TENANT NAME}** button. Select **Yes** to confirm.
9393

94-
Record the App ID URI (for example, `https://{ORGANIZATION}.onmicrosoft.com/{SERVER API APP CLIENT ID OR CUSTOM VALUE}`).
94+
Record the App ID URI (for example, `https://{TENANT}.onmicrosoft.com/{SERVER API APP CLIENT ID OR CUSTOM VALUE}`).
9595

9696
In **Home** > **Azure AD B2C** > **User flows**:
9797

@@ -304,18 +304,7 @@ builder.Services.AddMsalAuthentication(options =>
304304
});
305305
```
306306

307-
> [!NOTE]
308-
> If the Azure portal provides a scope URI and **the app throws an unhandled exception** when it receives a *401 Unauthorized* response from the API, try using a scope URI that doesn't include the scheme and host. For example, the Azure portal may provide one of the following scope URI formats:
309-
>
310-
> * `https://{ORGANIZATION}.onmicrosoft.com/{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
311-
> * `api://{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
312-
>
313-
> Supply the scope URI without the scheme and host:
314-
>
315-
> ```csharp
316-
> options.ProviderOptions.DefaultAccessTokenScopes.Add(
317-
> "{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}");
318-
> ```
307+
[!INCLUDE[](~/includes/blazor-security/azure-scope.md)]
319308

320309
For more information, see the following sections of the *Additional scenarios* article:
321310

aspnetcore/security/blazor/webassembly/hosted-with-azure-active-directory.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ In **API permissions**:
8989
1. Select **Add permissions**.
9090
1. Select the **Grant admin content for {TENANT NAME}** button. Select **Yes** to confirm.
9191

92-
Record the App ID URI (for example, `https://{ORGANIZATION}.onmicrosoft.com/{SERVER API APP CLIENT ID OR CUSTOM VALUE}`).
92+
Record the App ID URI (for example, `https://{TENANT}.onmicrosoft.com/{SERVER API APP CLIENT ID OR CUSTOM VALUE}`).
9393

9494
### Create the app
9595

@@ -292,18 +292,7 @@ builder.Services.AddMsalAuthentication(options =>
292292
});
293293
```
294294

295-
> [!NOTE]
296-
> If the Azure portal provides a scope URI and **the app throws an unhandled exception** when it receives a *401 Unauthorized* response from the API, try using a scope URI that doesn't include the scheme and host. For example, the Azure portal may provide one of the following scope URI formats:
297-
>
298-
> * `https://{ORGANIZATION}.onmicrosoft.com/{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
299-
> * `api://{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
300-
>
301-
> Supply the scope URI without the scheme and host:
302-
>
303-
> ```csharp
304-
> options.ProviderOptions.DefaultAccessTokenScopes.Add(
305-
> "{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}");
306-
> ```
295+
[!INCLUDE[](~/includes/blazor-security/azure-scope.md)]
307296

308297
For more information, see the following sections of the *Additional scenarios* article:
309298

aspnetcore/security/blazor/webassembly/standalone-with-authentication-library.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,7 @@ builder.Services.AddOidcAuthentication(options =>
8181
});
8282
```
8383

84-
> [!NOTE]
85-
> If the Azure portal provides a scope URI and **the app throws an unhandled exception** when it receives a *401 Unauthorized* response from the API, try using a scope URI that doesn't include the scheme and host. For example, the Azure portal may provide one of the following scope URI formats:
86-
>
87-
> * `https://{ORGANIZATION}.onmicrosoft.com/{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
88-
> * `api://{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
89-
>
90-
> Supply the scope URI without the scheme and host:
91-
>
92-
> ```csharp
93-
> options.ProviderOptions.DefaultScopes.Add(
94-
> "{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}");
95-
> ```
84+
[!INCLUDE[](~/includes/blazor-security/azure-scope.md)]
9685

9786
For more information, see the following sections of the *Additional scenarios* article:
9887

aspnetcore/security/blazor/webassembly/standalone-with-azure-active-directory-b2c.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,7 @@ builder.Services.AddMsalAuthentication(options =>
127127
});
128128
```
129129

130-
> [!NOTE]
131-
> If the Azure portal provides a scope URI and **the app throws an unhandled exception** when it receives a *401 Unauthorized* response from the API, try using a scope URI that doesn't include the scheme and host. For example, the Azure portal may provide one of the following scope URI formats:
132-
>
133-
> * `https://{ORGANIZATION}.onmicrosoft.com/{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
134-
> * `api://{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
135-
>
136-
> Supply the scope URI without the scheme and host:
137-
>
138-
> ```csharp
139-
> options.ProviderOptions.DefaultAccessTokenScopes.Add(
140-
> "{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}");
141-
> ```
130+
[!INCLUDE[](~/includes/blazor-security/azure-scope.md)]
142131

143132
For more information, see the following sections of the *Additional scenarios* article:
144133

aspnetcore/security/blazor/webassembly/standalone-with-azure-active-directory.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,7 @@ builder.Services.AddMsalAuthentication(options =>
122122
});
123123
```
124124

125-
> [!NOTE]
126-
> If the Azure portal provides a scope URI and **the app throws an unhandled exception** when it receives a *401 Unauthorized* response from the API, try using a scope URI that doesn't include the scheme and host. For example, the Azure portal may provide one of the following scope URI formats:
127-
>
128-
> * `https://{ORGANIZATION}.onmicrosoft.com/{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
129-
> * `api://{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
130-
>
131-
> Supply the scope URI without the scheme and host:
132-
>
133-
> ```csharp
134-
> options.ProviderOptions.DefaultAccessTokenScopes.Add(
135-
> "{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}");
136-
> ```
125+
[!INCLUDE[](~/includes/blazor-security/azure-scope.md)]
137126

138127
For more information, see the following sections of the *Additional scenarios* article:
139128

aspnetcore/security/blazor/webassembly/standalone-with-microsoft-accounts.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,7 @@ builder.Services.AddMsalAuthentication(options =>
119119
});
120120
```
121121

122-
> [!NOTE]
123-
> If the Azure portal provides a scope URI and **the app throws an unhandled exception** when it receives a *401 Unauthorized* response from the API, try using a scope URI that doesn't include the scheme and host. For example, the Azure portal may provide one of the following scope URI formats:
124-
>
125-
> * `https://{ORGANIZATION}.onmicrosoft.com/{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
126-
> * `api://{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}`
127-
>
128-
> Supply the scope URI without the scheme and host:
129-
>
130-
> ```csharp
131-
> options.ProviderOptions.DefaultAccessTokenScopes.Add(
132-
> "{API CLIENT ID OR CUSTOM VALUE}/{SCOPE NAME}");
133-
> ```
122+
[!INCLUDE[](~/includes/blazor-security/azure-scope.md)]
134123

135124
For more information, see the following sections of the *Additional scenarios* article:
136125

0 commit comments

Comments
 (0)