Rystem.Api.Client.Authentication.BlazorServer 10.0.7

dotnet add package Rystem.Api.Client.Authentication.BlazorServer --version 10.0.7
                    
NuGet\Install-Package Rystem.Api.Client.Authentication.BlazorServer -Version 10.0.7
                    
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="Rystem.Api.Client.Authentication.BlazorServer" Version="10.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rystem.Api.Client.Authentication.BlazorServer" Version="10.0.7" />
                    
Directory.Packages.props
<PackageReference Include="Rystem.Api.Client.Authentication.BlazorServer" />
                    
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 Rystem.Api.Client.Authentication.BlazorServer --version 10.0.7
                    
#r "nuget: Rystem.Api.Client.Authentication.BlazorServer, 10.0.7"
                    
#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 Rystem.Api.Client.Authentication.BlazorServer@10.0.7
                    
#: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=Rystem.Api.Client.Authentication.BlazorServer&version=10.0.7
                    
Install as a Cake Addin
#tool nuget:?package=Rystem.Api.Client.Authentication.BlazorServer&version=10.0.7
                    
Install as a Cake Tool

Rystem.Api.Client.Authentication.BlazorServer

Rystem.Api.Client.Authentication.BlazorServer adds token-based request enhancers for Rystem.Api.Client in Blazor Server applications.

It does not register generated API clients for you and it does not configure ASP.NET Core authentication middleware for you. Its job is narrower: attach authorization headers to the HTTP requests created by Rystem.Api.Client.

Installation

dotnet add package Rystem.Api.Client.Authentication.BlazorServer

What this package adds

The package exposes four extension methods:

Method Scope Token source
AddAuthenticationForAllEndpoints(settings) all generated clients Microsoft.Identity.Web
AddAuthenticationForEndpoint<T>(settings) one generated client Microsoft.Identity.Web
AddSocialAuthenticationForAllEndpoints(settings) all generated clients Rystem.Authentication.Social.Blazor
AddSocialAuthenticationForEndpoint<T>(settings) one generated client Rystem.Authentication.Social.Blazor

AuthorizationSettings currently exposes only:

  • Scopes

Typical Blazor Server setup

This follows the sample client app in src/Api/Test/Rystem.Api.TestClient/Program.cs.

var scopes = new[] { builder.Configuration["AzureAd:Scopes"]! };

builder.Services
    .AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))
    .EnableTokenAcquisitionToCallDownstreamApi(scopes)
    .AddInMemoryTokenCaches();

builder.Services.AddControllersWithViews()
    .AddMicrosoftIdentityUI();

builder.Services.AddMicrosoftIdentityConsentHandler();

builder.Services.AddBusiness();

builder.Services.AddClientsForAllEndpointsApi(http =>
{
    http.ConfigurationHttpClientForApi(client =>
    {
        client.BaseAddress = new Uri("https://localhost:7117");
    });
});

builder.Services.AddAuthenticationForAllEndpoints(settings =>
{
    settings.Scopes = scopes;
});

Microsoft Identity flow

The AddAuthenticationForAllEndpoints(...) and AddAuthenticationForEndpoint<T>(...) methods:

  1. create named AuthorizationSettings
  2. register them as singleton factory options
  3. add a request enhancer (TokenManager / TokenManager<T>)

At request time, that enhancer calls:

IAuthorizationHeaderProvider.CreateAuthorizationHeaderForUserAsync(scopes)

and applies the returned Authorization header to the outgoing request.

For endpoint-specific registration, the generic TokenManager<T> uses the named settings key for that interface.

Social flow

The social variants use SocialLoginManager from Rystem.Authentication.Social.Blazor and try to attach a bearer token fetched from the current social session.

If a social token cannot be fetched, the enhancer logs the user out and refreshes the navigation state.

Important caveats

This package is only an enhancer layer

You still need:

  • Rystem.Api.Client
  • endpoint/client registrations such as AddClientsForAllEndpointsApi(...)
  • your own Blazor Server auth setup

The social path is rough in the current implementation

Source-backed caveats:

  • the settings callback for the social registration methods is currently not stored anywhere meaningful
  • SocialTokenManager currently builds the Authorization header from the wrapper result object instead of the fetched token string

So the Microsoft Identity path is the better-documented and more reliable path today. Treat the social helpers as limited/experimental until they are cleaned up.

Enhancer ordering still comes from Rystem.Api.Client

If you register both global enhancers and endpoint-specific enhancers, all-endpoint enhancers run first, then endpoint-specific enhancers.

Grounded by sample files

  • src/Api/Test/Rystem.Api.TestClient/Program.cs
  • src/Api/Client/Rystem.Api.Client.Authentication.BlazorServer/DefaultInterceptor/ServiceCollectionExtensionsForAuthenticator.cs
  • src/Api/Client/Rystem.Api.Client.Authentication.BlazorServer/Authorization/TokenManager.cs
  • src/Api/Client/Rystem.Api.Client.Authentication.BlazorServer/Authorization/SocialTokenManager.cs

Use this package when you already have Blazor Server authentication in place and you want generated Rystem.Api.Client calls to carry bearer tokens automatically.

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
10.0.7 34 3/26/2026
10.0.6 148,180 3/3/2026
10.0.5 107 2/22/2026
10.0.4 110 2/9/2026
10.0.3 147,900 1/28/2026
10.0.1 209,084 11/12/2025
9.1.3 252 9/2/2025
9.1.2 764,499 5/29/2025
9.1.1 97,838 5/2/2025
9.0.32 186,702 4/15/2025
9.0.31 5,843 4/2/2025
9.0.30 88,806 3/26/2025
9.0.29 9,046 3/18/2025
9.0.28 256 3/17/2025
9.0.27 242 3/16/2025
9.0.26 262 3/13/2025
9.0.25 52,149 3/9/2025
9.0.20 19,614 3/6/2025
9.0.19 329 3/6/2025
9.0.18 314 3/4/2025
Loading failed