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
You can set additional options using the more generic `SetBrowserRequestOption` extension method.
229
+
230
+
The HTTP response is typically buffered in a Blazor WebAssembly app to enable support for sync reads on the response content. To enable support for response streaming, use the `SetBrowserResponseStreamingEnabled` extension method on the request.
231
+
219
232
For more information on Fetch API options, see [MDN web docs: WindowOrWorkerGlobalScope.fetch():Parameters](https://developer.mozilla.org/docs/Web/API/WindowOrWorkerGlobalScope/fetch#Parameters).
220
233
221
234
When sending credentials (authorization cookies/headers) on CORS requests, the `Authorization` header must be allowed by the CORS policy.
@@ -239,6 +252,8 @@ For more information, see <xref:security/cors> and the sample app's HTTP Request
> Use of the MSBuild property `<IsWebConfigTransformDisabled>` set to `true` isn't supported in Blazor WebAssembly apps [as it is for ASP.NET Core apps deployed to IIS](xref:host-and-deploy/iis/index#webconfig-file). For more information, see [Copy target required to provide custom Blazor WASM web.config (dotnet/aspnetcore #20569)](https://github.com/dotnet/aspnetcore/issues/20569).
97
+
To use a custom *web.config* file, place the custom *web.config* file at the root of the project folder and publish the project.
> The guidance in this article applies to the ASP.NET Core Blazor WebAssembly template version 3.2 or later. To obtain the latest Blazor WebAssembly template (version `3.2.0-preview4.20210.8`) when not using Visual Studio version 16.6 Preview 2 or later, see <xref:blazor/get-started>.
2
+
> The guidance in this article applies to the ASP.NET Core Blazor WebAssembly template version 3.2 or later. To obtain the latest Blazor WebAssembly template (version `3.2.0-preview5.20216.8`) when not using Visual Studio version 16.6 Preview 2 or later, see <xref:blazor/get-started>.
> The guidance in this section applies to the ASP.NET Core Blazor WebAssembly template version 3.2 or later. To obtain the latest Blazor WebAssembly template (version `3.2.0-preview4.20210.8`) when not using Visual Studio version 16.6 Preview 2 or later, see <xref:blazor/get-started>.
2
+
> The guidance in this section applies to the ASP.NET Core Blazor WebAssembly template version 3.2 or later. To obtain the latest Blazor WebAssembly template (version `3.2.0-preview5.20216.8`) when not using Visual Studio version 16.6 Preview 2 or later, see <xref:blazor/get-started>.
> 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
+
20
23
## Request additional access tokens
21
24
22
25
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.
@@ -56,6 +59,108 @@ if (tokenResult.TryGetToken(out var token))
56
59
* `true` withthe `token` foruse.
57
60
* `false` ifthetokenisn't retrieved.
58
61
62
+
## Attach tokens to outgoing requests
63
+
64
+
The `AuthorizationMessageHandler` servicecanbeusedwith `HttpClient` toattachaccesstokenstooutgoingrequests. Tokensareacquiredusingtheexisting `IAccessTokenProvider` service. Ifatokencan't be acquired, an `AccessTokenNotAvailableException` is thrown. `AccessTokenNotAvailableException` has a `Redirect` method that can be used to navigate the user to the identity provider to acquire a new token. The `AuthorizationMessageHandler` can be configured with the authorized URLs, scopes, and return URL using the `ConfigureHandler` method.
65
+
66
+
Inthefollowingexample, `AuthorizationMessageHandler` configuresan `HttpClient` in `Program.Main` (*Program.cs*):
Forconvenience, a `BaseAddressAuthorizationMessageHandler` isincludedthat'spreconfiguredwiththeappbaseaddressasanauthorizedURL. Theauthentication-enabledBlazorWebAssemblytemplatesnowuse [IHttpClientFactory](https://docs.microsoft.com/aspnet/core/fundamentals/http-requests) to set up an `HttpClient` with the `BaseAddressAuthorizationMessageHandler`:
Wheretheclientiscreatedwith `CreateClient` intheprecedingexample, the `HttpClient` issuppliedinstancesthatincludeaccesstokens when making requests to the server project.
> 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
+
20
23
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.
> 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
+
20
23
This article describes how to create a [Blazor WebAssembly hosted app](xref:blazor/hosting-models#blazor-webassembly) that uses [Azure Active Directory (AAD)](https://azure.microsoft.com/services/active-directory/) for authentication.
> 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
+
20
23
Blazor WebAssembly apps are secured in the same manner as Single Page Applications (SPAs). There are several approaches for authenticating users to SPAs, but the most common and comprehensive approach is to use an implementation based on the [OAuth 2.0 protocol](https://oauth.net/), such as [Open ID Connect (OIDC)](https://openid.net/connect/).
0 commit comments