Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
Getting Started
Providers
Authentik

Authentik Provider

Resources

Setup

Callback URL

https://example.com/api/auth/callback/authentik

Environment Variables

AUTH_AUTHENTIK_ID
AUTH_AUTHENTIK_SECRET
AUTH_AUTHENTIK_ISSUER

Configuration

/auth.ts
import NextAuth from "next-auth";
import Authentik from "next-auth/providers/authentik";
 
export const { handlers, auth, signIn, signOut } = NextAuth({
  providers: [Authentik({
    clientId: AUTH_AUTHENTIK_CLIENT_ID
    clientSecret: AUTH_AUTHENTIK_CLIENT_SECRET
    issuer: AUTH_AUTHENTIK_ISSUER
  })]
});
💡

issuer should include the slug without a trailing slash – e.g., https://my-authentik-domain.com/application/o/My_Slug

Auth.js © Balázs Orbán and Team - 2024