Skip to content

Installation

Install Moka.Auth using the .NET CLI:

Terminal window
dotnet add package Moka.Auth

Or using the Package Manager Console:

Terminal window
Install-Package Moka.Auth

Basic Setup

  1. Add the following to your appsettings.json:
{
"Authentication": {
"EnableJWT": true,
"EnableCookie": false,
"EnableOpenID": false,
"EnableApiKey": false
},
"Jwt": {
"Key": "your-secure-key-here",
"Issuer": "your-issuer",
"Audience": "your-audience",
"ExpirationMinutes": 30
}
}
  1. Configure services in Program.cs:
builder.Services.AddMokaAuth();

Or with custom configuration:

builder.Services.AddMokaAuth(options => {
options.EnableJWT = true;
options.JwtOptions = new JwtOptions {
Key = "your-secure-key-here",
Issuer = "your-issuer",
Audience = "your-audience",
ExpirationMinutes = 30
};
});

Next Steps

After installation, check out our Quick Start guide to learn how to implement authentication in your application.