Rask.Auth.Api 0.22.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Rask.Auth.Api --version 0.22.0
                    
NuGet\Install-Package Rask.Auth.Api -Version 0.22.0
                    
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="Rask.Auth.Api" Version="0.22.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rask.Auth.Api" Version="0.22.0" />
                    
Directory.Packages.props
<PackageReference Include="Rask.Auth.Api" />
                    
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 Rask.Auth.Api --version 0.22.0
                    
#r "nuget: Rask.Auth.Api, 0.22.0"
                    
#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 Rask.Auth.Api@0.22.0
                    
#: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=Rask.Auth.Api&version=0.22.0
                    
Install as a Cake Addin
#tool nuget:?package=Rask.Auth.Api&version=0.22.0
                    
Install as a Cake Tool

Rask.Auth.Api

Accounts as JSON endpoints, for an ASP.NET Core app that renders no Rask components — a TypeScript SPA host, a meta-framework host, or a plain ASP.NET app where the front end owns the UI.

Register, sign in, sign out, /me, email confirmation and password reset, all at /api/auth, backed by ASP.NET Core Identity (versioned password hashing, lockout, security stamps, token providers). The first account to register becomes the administrator.

builder.Services.AddRaskAuth<AppDbContext>();
builder.Services.AddAuthorization();

var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.MapRaskAuth();          // POST /register, /login, /logout — GET /me — plus the recovery flows

Map the tables in OnModelCreating and create the schema:

protected override void OnModelCreating(ModelBuilder modelBuilder) => modelBuilder.AddRaskAuth();
rask db add AddAuth && rask db update

Declare the account type once, anywhere in the app — the generator finds it, and adding a column is adding a property:

public class User : IdentityUser
{
}

Which package

Rask.Auth.Api This one. The front end owns sign-in; the host answers /api/auth. No components, no renderer, no Rask.Core.
Rask.Auth The app is a Rask app. Everything here, plus overridable /login, /register and /logout pages and a host-neutral IAuth for components.
Rask.Auth.Client The same flows called from a WebAssembly client.

Reference one of the first two, never both: Rask.Auth already contains this package.

Why it is separate

Rask.Core — the renderer — is not a package of its own. It travels inside the host packages that render components (Rask.Server, Rask.Wasm), so a host that renders nothing ships no copy of it. A battery that needed Core could therefore not run on Rask.Spa.Hosting or Rask.Meta.Hosting at all: the assembly is simply absent and the app aborts before Main.

This package is the accounts battery with that dependency removed. It talks to the wire contract in Rask.Wire — the /api/auth paths, the request and response shapes, AuthResult — which the browser-side Rask.Auth.Client also takes, so both halves agree without either one carrying the renderer.

Bearer tokens

Cookies are the default and the right answer for anything running in a page. A non-browser caller opts in:

builder.Services.AddRaskAuth<AppDbContext>(o => o.Bearer = new BearerOptions { SigningKey = key });

Then send X-Rask-Auth-Mode: bearer alongside X-Rask-Auth and a sign-in answers with a token in the body — never a cookie, never a header, so nothing stores it on the caller's behalf.

Email

Confirmation and reset links go out through the app's own mail queue (Rask.Mail), so they survive a restart between "the account exists" and "the email went out". An app with no mail battery is told it cannot send a reset link rather than silently queueing one nowhere.


Part of Rask. Full documentation: https://rask.sh/docs/guides/authentication.

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

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Rask.Auth.Api:

Package Downloads
Rask.Auth

Register, sign in and sign out for a Rask app, on by default. Accounts are the app's own User aggregate (PBKDF2 or bcrypt password hashing, passkeys beside the password, one revocable session row per signed-in device, sign-in throttling) and are exposed through Rask's own host-neutral surface — the same IUserProvider, Authorize component and [Authorize] routes work unchanged on the Server, WebAssembly, island, SPA and meta-framework hosts. rask new writes the /login, /register, /logout and /devices pages into the app, and the matching /api/auth endpoints give a TypeScript front end the same flows. Email confirmation and password reset go out through the app's own mail queue, with /confirm-email, /forgot-password and /reset-password pages scaffolded to match. The first account to register becomes the admin.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.22.1-alpha.0.23 0 9/17/2026
0.22.1-alpha.0.22 0 9/17/2026
0.22.1-alpha.0.21 0 9/17/2026
0.22.1-alpha.0.20 0 9/17/2026
0.22.1-alpha.0.18 0 9/17/2026
0.22.1-alpha.0.16 0 9/17/2026
0.22.1-alpha.0.15 22 9/16/2026
0.22.1-alpha.0.14 26 9/16/2026
0.22.1-alpha.0.13 27 9/16/2026
0.22.1-alpha.0.12 27 9/16/2026
0.22.1-alpha.0.9 42 9/16/2026
0.22.1-alpha.0.8 27 9/16/2026
0.22.1-alpha.0.7 28 9/16/2026
0.22.1-alpha.0.6 27 9/16/2026
0.22.1-alpha.0.4 30 9/16/2026
0.22.1-alpha.0.3 32 9/16/2026
0.22.1-alpha.0.2 31 9/16/2026
0.22.1-alpha.0.1 29 9/16/2026
0.22.0 73 9/16/2026
0.21.1-alpha.0.88 32 9/16/2026
Loading failed