NuvTools.Account.Client.Blazor
10.0.0
See the version list below for details.
dotnet add package NuvTools.Account.Client.Blazor --version 10.0.0
NuGet\Install-Package NuvTools.Account.Client.Blazor -Version 10.0.0
<PackageReference Include="NuvTools.Account.Client.Blazor" Version="10.0.0" />
<PackageVersion Include="NuvTools.Account.Client.Blazor" Version="10.0.0" />
<PackageReference Include="NuvTools.Account.Client.Blazor" />
paket add NuvTools.Account.Client.Blazor --version 10.0.0
#r "nuget: NuvTools.Account.Client.Blazor, 10.0.0"
#:package NuvTools.Account.Client.Blazor@10.0.0
#addin nuget:?package=NuvTools.Account.Client.Blazor&version=10.0.0
#tool nuget:?package=NuvTools.Account.Client.Blazor&version=10.0.0
NuvTools.Account.Client.Blazor
Browser side of signing in through Nuv Tools Account, for a product's Blazor WebAssembly app: the authorization code flow with PKCE as a public client, the callback that redeems the code, and signing out through the Account's end-session page.
The Account's access token is handed to the product once, on the callback — typically to exchange
it at the product's API for the product's own session (see NuvTools.Account.Client.AspNetCore). No
refresh token is asked of the Account.
Registering
builder.Services.AddNuvToolsAccountSignIn(options =>
{
options.Scopes.Add("dataprovider-api"); // the product API's scope, which is also its audience
options.DefaultReturnPath = "/portal";
});
With Authority and ClientId left empty, they are read from account-settings.json on the app's own
host, which MapNuvToolsAccountSettings serves per environment. The client must be registered at the
Account with the redirect address {base}authentication/login-callback and the post-sign-out address
{base} (both configurable).
Signing in
// The sign-in screen
if (!AccountSignIn.SigningOut)
await AccountSignIn.StartAsync(returnUrl);
// The page at /authentication/login-callback
var completed = await AccountSignIn.CompleteAsync(new Uri(Navigation.Uri),
accountAccessToken => Authentication.SignInWithAccountAsync(accountAccessToken));
Navigation.NavigateTo(completed.Succeeded ? completed.Data!.ReturnUrl : "/login?failed=true", replace: true);
CompleteAsync runs once per page load: opening a session usually rebuilds the callback page, and
the second instance receives the first one's answer. The state is spent on the way in, so the same
response cannot be used twice. Return addresses off the app are replaced by DefaultReturnPath.
Signing out
var accountSignOut = await AccountSignIn.SignOutAddressAsync(); // read before clearing the session
await Authentication.LogoutAsync();
Navigation.NavigateTo(accountSignOut ?? "/", forceLoad: true);
SignOutAddressAsync sets SigningOut, which a sign-in screen checks so that ending the local
session does not start a new sign-in and cancel the trip to the Account. ManageAddressAsync gives
the Account's page where the person manages their password, second factors and passkeys.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.13)
- NuvTools.AspNetCore.Blazor (>= 10.1.12)
- NuvTools.Common (>= 10.0.12)
- NuvTools.Resources (>= 10.1.4)
-
net8.0
- Microsoft.Extensions.Http (>= 10.0.13)
- NuvTools.AspNetCore.Blazor (>= 10.1.12)
- NuvTools.Common (>= 10.0.12)
- NuvTools.Resources (>= 10.1.4)
-
net9.0
- Microsoft.Extensions.Http (>= 10.0.13)
- NuvTools.AspNetCore.Blazor (>= 10.1.12)
- NuvTools.Common (>= 10.0.12)
- NuvTools.Resources (>= 10.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.