Configure the Client
The client in the recommended application model stays on the host origin and uses SessionAuth-aware services instead of direct browser bearer-token API calls.
Configure the interactive client so it stays aligned with the authenticated host session and calls the host origin instead of the downstream API directly.
Register SessionAuth-aware client services
In the client Program.cs, register SessionAuth together with the Recrovit component routing services.
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Recrovit.AspNetCore.Components.Routing.Configuration;
using Recrovit.RecroGridFramework.Client.Blazor;
using Recrovit.RecroGridFramework.Client.Blazor.SessionAuth;
using Recrovit.RecroGridFramework.Client.Blazor.UI;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddRgfBlazorSessionAuthClientServices(
builder.Configuration,
apiBaseAddressOverride: builder.HostEnvironment.BaseAddress);
builder.Services.AddRecrovitComponentRouting(options =>
{
options.AddRouteAssembly(typeof(Program).Assembly);
});
var host = builder.Build();
await host.Services.InitializeRgfBlazorAsync();
await host.Services.InitializeRgfUIAsync();
await host.RunAsync();
Using builder.HostEnvironment.BaseAddress keeps browser requests on the local host origin so the host can own authentication and proxy behavior.
Configure the route shell
Render the client routes through RecrovitRoutes so the SessionAuth route wrapper can enforce route-aware authentication behavior.
@using Recrovit.AspNetCore.Components.Routing
@using Recrovit.AspNetCore.Components.Routing.Models
<RecrovitRoutes Kind="RecrovitRoutesKind.Client"
AppAssembly="typeof(_Imports).Assembly"
DefaultLayout="typeof(MainLayout)"
NotFoundPage="typeof(Pages.NotFound)" />
Configure the shared root for host rendering
When the host and interactive client share the same application root, configure App.razor so host-routed pages stay on the server pipeline and client-routed pages use the interactive client renderer.
<head>
<HeadOutlet @rendermode="CurrentRenderMode" />
</head>
<body>
@if (CurrentPageDefinition.RouteMode is RecrovitRouteMode.StaticServer or RecrovitRouteMode.InteractiveServer)
{
<RecrovitRoutes @rendermode="CurrentRenderMode" Kind="RecrovitRoutesKind.Host" />
@if (CurrentPageDefinition.RouteMode == RecrovitRouteMode.InteractiveServer)
{
<ReconnectModal />
}
}
else
{
<BlazorApp.Client.Routes @rendermode="CurrentRenderMode" />
}
<script src="@Assets["_framework/blazor.web.js"]"></script>
</body>
Runtime expectation
After configuration:
- protected client routes validate the host session through SessionAuth;
- principal state is rebuilt from the host authentication endpoints;
- client-side RecroGrid Framework calls stay on the host origin and can use the downstream proxy path behind the scenes.