Arc4u.OAuth2.Blazor
9.0.0
Prefix Reserved
dotnet add package Arc4u.OAuth2.Blazor --version 9.0.0
NuGet\Install-Package Arc4u.OAuth2.Blazor -Version 9.0.0
<PackageReference Include="Arc4u.OAuth2.Blazor" Version="9.0.0" />
<PackageVersion Include="Arc4u.OAuth2.Blazor" Version="9.0.0" />
<PackageReference Include="Arc4u.OAuth2.Blazor" />
paket add Arc4u.OAuth2.Blazor --version 9.0.0
#r "nuget: Arc4u.OAuth2.Blazor, 9.0.0"
#:package Arc4u.OAuth2.Blazor@9.0.0
#addin nuget:?package=Arc4u.OAuth2.Blazor&version=9.0.0
#tool nuget:?package=Arc4u.OAuth2.Blazor&version=9.0.0
Arc4u.OAuth2.Blazor
Authentication for the client (WebAssembly) project of a Blazor Web App, whose server signs the user in with a cookie: gets the user's access token from the server with that cookie, sends it to APIs, and builds the Arc4u AppPrincipal from the authentication state sent by the server.
Standalone Blazor WebAssembly apps, which sign the user in themselves, are not supported.
Install
dotnet add package Arc4u.OAuth2.Blazor
Usage
builder.Services.AddTransient<AttachCookiesHandler>();
builder.Services.AddAuthenticationCookie(builder.Configuration);
builder.Services.AddKeyedSingleton<ITokenProvider, ClientTokenProvider>(ClientTokenProvider.ProviderName);
builder.Services.AddHttpClient<InventoryClient>()
.AddHttpMessageHandler(sp => new JwtHttpHandler(sp,
sp.GetRequiredService<ILogger<JwtHttpHandler>>(),
sp.GetRequiredService<IOptionsMonitor<SimpleKeyValueSettings>>().Get("OAuth2")));
AddAuthenticationCookie reads the Authentication:OAuth2.Settings section (BaseUri and TokenRequestUrl of the server endpoint that returns the token).
ConfigureAuthStateDeserializationOptions and AppPrincipalFromAuthenticationState rebuild the AppPrincipal from the authentication state that the server serializes with AddAuthenticationStateSerialization:
builder.Services.AddAuthorizationCore();
builder.Services.AddCascadingAuthenticationState();
builder.Services.AddAuthenticationStateDeserialization();
builder.Services.AddSingleton<IAppPrincipalAuthenticationStateProvider, AppPrincipalFromAuthenticationState>();
builder.Services.AddSingleton<IConfigureOptions<AuthenticationStateDeserializationOptions>, ConfigureAuthStateDeserializationOptions>();
Documentation
- Guide: Blazor
- API reference: Arc4u.Blazor
- Source and issues: github.com/Arc4u-org/Arc4u
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
-
net10.0
- Arc4u.OAuth2.Client (>= 9.0.0)
- Microsoft.AspNetCore.Components.WebAssembly (>= 10.0.0)
- Microsoft.AspNetCore.Components.WebAssembly.Authentication (>= 10.0.0)
- Microsoft.Extensions.Http (>= 10.0.0)
-
net11.0
- Arc4u.OAuth2.Client (>= 9.0.0)
- Microsoft.AspNetCore.Components.WebAssembly (>= 11.0.0)
- Microsoft.AspNetCore.Components.WebAssembly.Authentication (>= 11.0.0)
- Microsoft.Extensions.Http (>= 11.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 9.0.0 | 65 | 11/10/2026 |
| 9.0.0-preview46 | 56 | 11/3/2026 |
| 9.0.0-preview45 | 58 | 11/2/2026 |
| 9.0.0-preview44 | 62 | 11/1/2026 |
| 9.0.0-preview43 | 56 | 11/1/2026 |
| 9.0.0-preview42 | 58 | 10/30/2026 |
| 9.0.0-preview41 | 61 | 10/30/2026 |
| 9.0.0-preview40 | 61 | 10/27/2026 |
| 9.0.0-preview39 | 58 | 10/24/2026 |
| 9.0.0-preview38 | 57 | 10/22/2026 |
| 9.0.0-preview37 | 546 | 8/11/2026 |
| 9.0.0-preview36 | 399 | 7/28/2026 |
| 9.0.0-preview35 | 80 | 7/27/2026 |
| 9.0.0-preview34 | 85 | 7/27/2026 |
| 9.0.0-preview33 | 106 | 6/15/2026 |
| 9.0.0-preview32 | 90 | 6/14/2026 |
| 9.0.0-preview31 | 104 | 5/20/2026 |
| 9.0.0-preview30 | 88 | 5/19/2026 |
| 9.0.0-preview29 | 96 | 5/15/2026 |
| 9.0.0-preview28 | 91 | 5/15/2026 |