Urgent.News

What's breaking now, across thousands of outlets.

Tech

An Angular + .NET Auth Template with Multi-Channel 2FA and a Live Demo

Most auth starter templates ask you to take them on faith. The README promises login, 2FA, and password reset, and you find out whether any of it works after you've cloned it and spent an evening wiring it up. angular-dotnet-auth-template is my attempt to do better: an Angular 21 + .NET 10 starter with local auth and multi-channel 2FA (authenticator/TOTP, email, SMS) out of the box, and a live…

Angular + .NET Auth Template with Multi-Channel 2FA and a Live Demo

This auth starter template provides an Angular 21 + .NET 10 solution featuring local authentication and multi-channel two-factor authentication (2FA) via authenticator/TOTP, email, and SMS. The template also includes a live demo running on Cloud Run, deployed using the same pipeline, and running entirely on free tiers.

The stack chosen for this template is current and includes standalone Angular components with zoneless change detection, .NET 10, a Docker-based local development environment, xUnit integration tests against the API via WebApplicationFactory, Vitest for the client, and a full Playwright end-to-end (E2E) suite covering the auth flows. The template is a proper GitHub template, following the same conventions as the author's NuGet release template.

The interesting logic behind the template is encapsulated in NuGet packages rather than being baked into scaffolded code. These packages include DGates.Identity.NotificationProviders, which provides implementations for IEmailSender and ISmsSender for SendGrid, Postmark, Twilio, and AWS SNS, as well as DGates.Identity.Jwt2Fa, which handles JWT issuance and 2FA orchestration behind an IAuthCoreService<TUser> abstraction. Generated projects update these packages with fixes instead of manually applying diffs.

The template itself is the first production consumer of these packages, ensuring any updates become available with a single package update. Local development does not require real messaging service accounts; instead, mock servers for SendGrid, Postmark, and Twilio are provided as public GHCR images, allowing generated repos to pull them without any authentication setup.

A live demo is included in the template and runs the same stack as the template, including MySQL. The demo uses free-tier Aiven MySQL, with an automated power-on-and-poll step in the deploy workflow to handle its idle shutdown. The demo also uses the same mock servers for email and SMS traffic as local development, deployed as separate scale-to-zero Cloud Run services. These mock servers cost nothing while idle and provide a convenient way to test the demo without incurring real costs for paid services.

The template follows a zero-dollar approach, free of long-lived credentials or static secrets, using Workload Identity Federation instead of service account keys. This setup ensures the demo remains faithful to the template by running the same code and configuration, including the use of real messaging service providers for email and SMS 2FA. This approach provides a more accurate representation of the template's functionality and eliminates any discrepancy between the local development environment and the live demo.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Grml 2026.09 released

Version 2026.09 , code-named "Hättiwaritätti", of the Debian-based Grml live Linux distribution for system administrators has been released.

More from Friday 4 September →