Passwordless 2.0.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Passwordless --version 2.0.0                
NuGet\Install-Package Passwordless -Version 2.0.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="Passwordless" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Passwordless --version 2.0.0                
#r "nuget: Passwordless, 2.0.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.
// Install Passwordless as a Cake Addin
#addin nuget:?package=Passwordless&version=2.0.0

// Install Passwordless as a Cake Tool
#tool nuget:?package=Passwordless&version=2.0.0                

Passwordless .NET SDK

Build Coverage Version Downloads

The official Bitwarden Passwordless.dev .NET library, supporting .NET Standard 2.0+, .NET Core 2.0+, and .NET Framework 4.6.2+.

Install

  • NuGet: dotnet add package Passwordless

See also

Integration packages:

Examples:

Usage

💡 See the full Getting started guide in the official documentation.

Resolve the client

Add Passwordless to your service container:

// In Program.cs or Startup.cs
services.AddPasswordlessSdk(options =>
{
    options.ApiSecret = "your_api_secret";
    options.ApiKey = "your_api_key";
});

Inject the client into your controller:

public class HomeController(IPasswordlessClient passwordlessClient) : Controller
{
    // ...
}

Register a passkey

Define an action or an endpoint to generate a registration token:

[HttpGet("/create-token")]
public async Task<IActionResult> GetRegisterToken(string alias)
{
    // Get existing userid from session or create a new user in your database
    var userId = Guid.NewGuid().ToString();
    
    // Provide the userid and an alias to link to this user
    var payload = new RegisterOptions(userId, alias)
    {
        // Optional: Link this userid to an alias (e.g. email)
        Aliases = [alias]
    };
    
    try
    {
        var tokenRegistration = await passwordlessClient.CreateRegisterTokenAsync(payload);
    
        // Return this token to the frontend
        return Ok(tokenRegistration);
    }
    catch (PasswordlessApiException e)
    {
        return new JsonResult(e.Details)
        {
            StatusCode = (int?)e.StatusCode,
        };
    }
}

Verify user

Define an action or an endpoint to verify an authentication token:

[HttpGet("/verify-signin")]
public async Task<IActionResult> VerifyAuthenticationToken(string token)
{
    try
    {
        var verifiedUser = await passwordlessClient.VerifyTokenAsync(token);

        // Sign the user in, set a cookie, etc
        return Ok(verifiedUser);
    }
    catch (PasswordlessApiException e)
    {
        return new JsonResult(e.Details)
        {
            StatusCode = (int?)e.StatusCode
        };
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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 Passwordless:

Package Downloads
Passwordless.AspNetCore

The official Bitwarden Passwordless.dev .NET library for ASP.NET Core identity

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.0-beta.4 462 10/4/2024
2.1.0-beta.3 393 9/9/2024
2.1.0-beta.2 729 8/26/2024
2.1.0-beta.1 712 8/14/2024
2.0.0 442 8/13/2024
2.0.0-beta9 123 7/29/2024
2.0.0-beta8 3,144 4/11/2024
2.0.0-beta7 2,239 3/11/2024
2.0.0-beta6 276 2/16/2024
2.0.0-beta5 9,989 11/8/2023
2.0.0-beta4 141 10/27/2023
2.0.0-beta3 139 10/25/2023
2.0.0-beta2 151 10/4/2023
2.0.0-beta10 317 8/6/2024
2.0.0-beta1 1,312 9/29/2023
1.0.2 9,144 9/4/2023
0.0.14 928 8/14/2023
0.0.12 224 8/8/2023
0.0.11 180 8/8/2023
0.0.11-beta1 287 8/8/2023
0.0.0-ci-d5f30b6 99 5/21/2024