The official Bitwarden Passwordless.dev ASP.NET Identity integration. Automatically adds endpoints to verify passwordless signin and sign the user in using the existing ASP.NET Identity code.
- NuGet:
dotnet add package Passwordless.AspNetCore
💡 See the full Getting started guide in the official documentation.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddIdentity<MyUser, MyRole>()
.AddEntityFrameworkStores<MyDbContext>()
.AddPasswordless(builder.Configuration.GetRequiredSection("Passwordless"));
var app = builder.Build();
app.MapPasswordless();
app.Run();
// In Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddIdentity<MyUser, MyRole>()
.AddEntityFrameworkStores<MyDbContext>()
.AddPasswordless(Configuration.GetRequiredSection("Passwordless"));
services.AddControllers();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapPasswordless();
endpoints.MapControllers();
});
}