Endatix JWT Customization
The built-in Endatix JWT provider offers secure, stateless authentication with full customization options. This guide shows you how to configure and customize JWT authentication for your specific needs.
Overview
The Endatix JWT provider is automatically included and provides:
- Stateless Authentication: No server-side session storage required
- Secure Token Handling: Server-side only, never exposed to client
- Automatic Integration: Seamless communication between Hub and API
- Flexible Configuration: Customizable token lifetimes and validation
Basic Configuration
EndatixAPI Configuration (appsettings.json)
- Development
- Production
// appsettings.Development.json
{
"Endatix": {
"Auth": {
"Providers": {
"EndatixJwt": {
"Enabled": true,
"SigningKey": "{JWT_SIGNING_KEY}",
"AccessExpiryInMinutes": 900,
"RefreshExpiryInDays": 7,
"Issuer": "https://localhost:5001"
}
}
}
}
}
Use {JWT_SIGNING_KEY} or user secrets — never commit production signing keys. See auth settings for generating and storing a local key.
// appsettings.json
{
"Endatix": {
"Auth": {
"Providers": {
"EndatixJwt": {
"Enabled": true,
"SigningKey": "{JWT_SIGNING_KEY_SECRET}",
"AccessExpiryInMinutes": 15,
"RefreshExpiryInDays": 30,
"Issuer": "https://api.yourdomain.com"
}
}
}
}
}
Endatix Hub Configuration
The Endatix JWT provider is automatically registered - no additional setup required. Set these in the Hub .env file:
# .env
# Required, at least 32 bytes. Generate your own with `openssl rand -base64 32` or `npx auth secret`
AUTH_SECRET=<your-generated-secret>
# Needed for production deployment to ensure the authentication works correctly under reverse proxy - https://authjs.dev/getting-started/deployment
AUTH_TRUST_HOST=true
Sign-in Attempts
POST /api/auth/login counts wrong passwords per account. After 5 wrong passwords in a row, the account can't sign in for 15 minutes, even with the right password. A successful sign-in, or an administrator unlocking the user (POST /api/users/{userId}/unlock), resets the count.
Every refused sign-in gets the same 400 response, whether the password is wrong, the account is locked out, or no account has that email:
{
"title": "There was a problem with your request",
"detail": "The supplied credentials are invalid"
}
A client that signs in for a script or integration should stop after a refused sign-in rather than retry, so it doesn't lock the account out. Accounts that sign in through an external provider are not counted. For what administrators see, see Users.