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: aspnetcore/includes/blazor-security/authentication-component.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ The page produced by the `Authentication` component (*Pages/Authentication.razor
2
2
3
3
The `RemoteAuthenticatorView` component:
4
4
5
-
* Is provided by the `Microsoft.AspNetCore.Components.WebAssembly.Authentication` package.
5
+
* Is provided by the [Microsoft.AspNetCore.Components.WebAssembly.Authentication](https://www.nuget.org/packages/Microsoft.AspNetCore.Components.WebAssembly.Authentication/) package.
6
6
* Manages performing the appropriate actions at each stage of authentication.
Copy file name to clipboardExpand all lines: aspnetcore/includes/blazor-security/troubleshoot.md
+15-3Lines changed: 15 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
## Troubleshoot
2
2
3
-
### Cookies and site data
3
+
### Cookies and site dataAppXq0fevzme2pys62n3e0fbqa7peapykr8v
4
4
5
5
Cookies and site data can persist across app updates and interfere with testing and troubleshooting. Clear the following when making app code changes, user account changes with the provider, or provider app configuration changes:
6
6
@@ -10,8 +10,20 @@ Cookies and site data can persist across app updates and interfere with testing
10
10
11
11
One approach to prevent lingering cookies and site data from interfering with testing and troubleshooting is to:
12
12
13
-
* Use a browser for testing that you can configure to delete all cookie and site data each time the browser is closed.
14
-
* Close the browser between any change to the app, test user, or provider configuration.
13
+
* Configure a browser
14
+
* Use a browser for testing that you can configure to delete all cookie and site data each time the browser is closed.
15
+
* Make sure that the browser is closed manually or by the IDE between any change to the app, test user, or provider configuration.
16
+
* Use a custom command to open a browser in incognito or private mode in Visual Studio:
17
+
* Open **Browse With** dialog box from Visual Studio's **Run** button.
18
+
* Select the **Add** button.
19
+
* Provide the path to your browser in the **Program** field.
20
+
* In the **Arguments** field, provide the command-line option that the browser uses to open in incognito or private mode and the URL of the app. For example:
21
+
* Google Chrome –`--incognito --new-window https://localhost:5001`
22
+
* Mozilla Firefox –`-private -url https://localhost:5001`
23
+
* Provide a name in the **Friendly name** field. For example, `Firefox PRIVATE`.
24
+
* Select the **OK** button.
25
+
* To avoid having to select the browser profile for each iteration of testing with an app, set the profile as the default with the **Set as Default** button.
26
+
* Make sure that the browser is closed by the IDE between any change to the app, test user, or provider configuration.
> The guidance in this article applies to ASP.NET Core 3.2 Preview 4. This topic will be updated to cover Preview 5 on Friday, April 24.
22
-
23
20
## Request additional access tokens
24
21
25
22
Most apps only require an access token to interact with the protected resources that they use. In some scenarios, an app might require more than one token in order to interact with two or more resources.
The `IAccessTokenProvider.RequestToken` method provides an overload that allows an app to provision a token with a given set of scopes, asseeninthefollowingexample:
38
+
The `IAccessTokenProvider.RequestToken` method provides an overload that allows an app to provision an access token with a given set of scopes, asseeninthefollowingexample:
Wheretheclientiscreatedwith `CreateClient` intheprecedingexample, the `HttpClient` issuppliedinstancesthatincludeaccesstokens when making requests to the server project.
@@ -508,7 +506,8 @@ public void ConfigureServices(IServiceCollection services)
> The guidance in this article applies to ASP.NET Core 3.2 Preview 4. This topic will be updated to cover Preview 5 on Friday, April 24.
22
-
23
20
This article describes how to create a Blazor WebAssembly standalone app that uses [Azure Active Directory (AAD) B2C](/azure/active-directory-b2c/overview) for authentication.
24
21
25
22
## Register apps in AAD B2C and create solution
@@ -122,7 +119,7 @@ The support for authenticating and authorizing calls to ASP.NET Core Web APIs is
The WeatherForecast controller (*Controllers/WeatherForecastController.cs*) exposes a protected API with the `[Authorize]` attribute applied to the controller. It's **important** to understand that:
@@ -215,6 +225,19 @@ The `Microsoft.Authentication.WebAssembly.Msal` package transitively adds the `M
215
225
216
226
### Authentication service support
217
227
228
+
Support for `HttpClient` instances is added that include access tokens when making requests to the server project.
Support for authenticating users is registered in the service container with the `AddMsalAuthentication` extension method provided by the `Microsoft.Authentication.WebAssembly.Msal` package. This method sets up all of the services required for the app to interact with the Identity Provider (IP).
The `AddMsalAuthentication` method accepts a callback to configure the parameters required to authenticate an app. The values required for configuring the app can be obtained from the Azure Portal AAD configuration when you register the app.
235
260
261
+
Configuration is supplied by the *wwwroot/appsettings.json* file:
262
+
263
+
```json
264
+
{
265
+
"AzureAdB2C": {
266
+
"Authority": "{AAD B2C INSTANCE}{DOMAIN}/{SIGN UP OR SIGN IN POLICY}",
0 commit comments