SyntaxCircus.Blazor.Auth 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SyntaxCircus.Blazor.Auth --version 0.1.1
                    
NuGet\Install-Package SyntaxCircus.Blazor.Auth -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SyntaxCircus.Blazor.Auth" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SyntaxCircus.Blazor.Auth" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="SyntaxCircus.Blazor.Auth" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SyntaxCircus.Blazor.Auth --version 0.1.1
                    
#r "nuget: SyntaxCircus.Blazor.Auth, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SyntaxCircus.Blazor.Auth@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SyntaxCircus.Blazor.Auth&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=SyntaxCircus.Blazor.Auth&version=0.1.1
                    
Install as a Cake Tool

SyntaxCircus.Blazor.Auth

Build NuGet License: MIT

Server-side OIDC token forwarding, refresh, and resilience for interactive Blazor Server applications. The tokens issued at cookie/OIDC sign-in are cached, refreshed, and attached to outgoing calls to your backend API — on the initial HTTP request and later inside the SignalR circuit, where there's no HttpContext to read the auth cookie from.

No support guaranteed. Published as-is and maintained on a best-effort basis. Issues and PRs are welcome, but there's no SLA — fork it or vendor what you need if that's not enough.

Usage

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddBlazorTokenForwarding(builder.Configuration);
builder.Services.AddHttpClient<IMyApiClient, MyApiClient>(client =>
    client.BaseAddress = new Uri(builder.Configuration["Api:BaseUrl"]!))
    .AddHttpMessageHandler<ApiAuthHandler>();

var app = builder.Build();

app.UseAuthentication();
app.UseAuthorization();
app.UseBlazorTokenCache(); // after UseAuthorization(), before antiforgery
app.UseAntiforgery();

Configure normal cookie + OIDC authentication yourself (with SaveTokens = true and the offline_access scope) — this package only handles what happens to the tokens after sign-in.

Configuration

Section Purpose
Authentication:Oidc Authority, ClientId, ClientSecret, Scopes, TokenCache:RefreshSkewSeconds, TokenCache:FallbackAccessTokenLifetimeSeconds
Authentication:Oidc:TokenCache:Redis Enabled, ConnectionString, InstanceName — set Enabled: true to back the token cache with Redis for multi-instance deployments; in-process otherwise
Api BaseUrl, TimeoutSeconds
Api:ClientCredentials Optional. TokenEndpoint, ClientId, ClientSecret, Audience, Scope — when set, anonymous circuit calls fall back to a client-credentials (M2M) token instead of going out unauthenticated

Extras

  • SyntaxCircus.Blazor.Auth.Diagnostics.AuthDebugEndpoints.MapAuthDebugEndpoints() — opt-in /debug/claims and /debug/token endpoints for inspecting the current principal and cached tokens. Never wired automatically; call it yourself, gated behind IsDevelopment().
  • SyntaxCircus.Blazor.Auth.Components.Errors.GlobalErrorBoundary / GlobalErrorView / LoggingErrorBoundary — a Bootstrap-styled error boundary that logs unhandled exceptions and auto-recovers on navigation.
  • SyntaxCircus.Blazor.Auth.Components.Layout.ReconnectModal — the standard Blazor Server reconnect-UI markup (rejoin animation, pause/resume states).

Contributing

Issues and pull requests are welcome:

  • Keep changes focused, with a clear description of the behavior change.
  • Match the existing code style (see .editorconfig).
  • Call out any breaking changes to the public API in your PR description.

License

MIT — see LICENSE.txt.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.6 245 8/26/2026
0.1.5 109 8/21/2026
0.1.4 107 8/17/2026
0.1.3 106 8/17/2026
0.1.2 105 8/16/2026
0.1.1 101 8/16/2026