Passage.NET 1.1.0

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

// Install Passage.NET as a Cake Tool
#tool nuget:?package=Passage.NET&version=1.1.0                

<img src="https://storage.googleapis.com/passage-docs/passage-logo-gradient.svg" alt="Passage logo" style="width:250px;"/>

GitHub Workflow Status GitHub Downloads NuGet current

Passage.NET

This dotnet SDK allows for verification of server-side authentication for applications using Passage

💾 Installation

Install this package using nuget.

dotnet add pacakge Passage.NET

💉 Dependency injection

If you want to integrate with HttpClientFactory and Microsoft.Extensions.DependencyInjection

dotnet add pacakge Passage.Net.Extensions.DependencyInjection

Usage:

//...
builder.Services.AddPassage(options =>
{
    options.AppId = "YOUR_APP_ID";
    options.ApiKey = "YOUR_API_KEY";
});
//...
var app = builder.Build();
//...
app.MapGet("/getapp", async (IPassage passage) =>
{
    var appinfo = await passage.GetApp();
    return appinfo;
})

📒 Usage

Validate JWT

You need to provide Passage with your App ID in order to verify the JWTs.

var config = new PassageConfig()
{
    AppId = "YOUR_APP_ID"
}

var passage = new Passage(config);

var subject = await passage.ValidateToken("JWT_TO_VALIDATE");

Retrieve App Info

To retrieve information about an app, you should use the passage.GetApp() function.

var config = new PassageConfig()
{
    AppId = "YOUR_APP_ID",
    ApiKey = "YOUR_API_KEY"
}

var passage = new Passage(config);

var passageApp = await passage.GetApp();

Retrieve User Information By Identifier

To retrieve information about a user, you should use the passage.GetUserByIdentifier("your@email.cc") function.

var config = new PassageConfig()
{
    AppId = "YOUR_APP_ID",
    ApiKey = "YOUR_API_KEY"
}

var passage = new Passage(config);

var passageUser = await passage.GetUserByIdentifier("user@email.cc");

Retrieve User Information By User Id

To retrieve information about a user, you should use the passage.GetUser("USER_ID") function.

var config = new PassageConfig()
{
    AppId = "YOUR_APP_ID",
    ApiKey = "YOUR_API_KEY"
}

var passage = new Passage(config);

var passageUser = await passage.GetUser("USER_ID");

Create a User

You can also create a Passage user by providing an email or phone (phone number must be a valid E164 phone number).

var config = new PassageConfig()
{
    AppId = "YOUR_APP_ID",
    ApiKey = "YOUR_API_KEY"
}

var passage = new Passage(config);

var createRequest = new CreateUserRequest()
{
    Email = "user@email.cc",
    //note that user_metadata is an optional field and is defined in your Passage App settings (Registration Fields).
    User_metadata = new
    {
        example = 123
    }
};
    
var passageUser = await passage.CreateUser(createRequest);

Update a User

You can update a user attributes

var config = new PassageConfig()
{
    AppId = "YOUR_APP_ID",
    ApiKey = "YOUR_API_KEY"
}

var passage = new Passage(config);

var updateRequest = new UpdateUserRequest()
{
    Email = "user@email.cc",
    //note that user_metadata is an optional field and is defined in your Passage App settings (Registration Fields).
    User_metadata = new
    {
        example = 1234
    }
};

var passageUser = await passage.UpdateUser("USER_ID",updateRequest);

Delete a User

To delete a Passage user, you will need to provide the userID, and corresponding app credentials.

var config = new PassageConfig()
{
    AppId = "YOUR_APP_ID",
    ApiKey = "YOUR_API_KEY"
}

var passage = new Passage(config);

await passage.DeleteUser("USER_ID");
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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 Passage.NET:

Package Downloads
Passage.Net.Extensions.DependencyInjection

integrate Passage with HttpClientFactory and Microsoft.Extensions.DependencyInjection

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.0 185 5/30/2024
1.2.0 166 4/7/2024
1.1.1 154 4/3/2024
1.1.0 150 4/2/2024
1.0.0 124 4/1/2024
0.1.0-beta 82 4/1/2024