9.7 KiB
Authentik Setup Guide for Kaboot
This guide walks through configuring Authentik as the OAuth2/OIDC identity provider for Kaboot.
Prerequisites
- Docker and Docker Compose installed
- Kaboot stack running (
docker compose up -d) - Access to
http://localhost:9000
Step 1: Initial Authentik Setup
-
Navigate to
http://localhost:9000/if/flow/initial-setup/- Important: Include the trailing slash
/
- Important: Include the trailing slash
-
Create the admin account:
- Email: Your email address
- Password: Choose a strong password
-
Log in with the credentials you just created
Step 2: Create the Kaboot Application
-
In the Authentik admin interface, go to Applications > Applications
-
Click Create with provider
-
Application Settings:
Field Value Name KabootSlug kabootLaunch URL http://localhost:5173 -
Click Next
Step 3: Configure OAuth2/OIDC Provider
-
Select OAuth2/OIDC as the Provider Type
-
Click Next
-
Provider Configuration:
Field Value Name Kaboot OAuth2Authorization flow default-provider-authorization-implicit-consentClient type PublicClient ID kaboot-spa -
Redirect URIs (one per line):
http://localhost:5173/callback http://localhost:5173/silent-renew.html http://localhost:5173 -
Advanced Settings:
Field Value Subject mode Based on the User's hashed IDInclude claims in id_token YesIssuer mode Each provider has a different issuer -
Scopes - Ensure these are selected:
openidprofileemailoffline_access(for refresh tokens)
-
Click Submit
Step 4: Enable User Registration (Sign Up)
By default, Authentik only shows a login form. To allow users to sign up, you need to create an enrollment flow and link it.
Step 4.1: Create the Enrollment Prompt Stage
-
Go to Flows and Stages > Stages
-
Click Create
-
Select Prompt Stage and click Next
-
Configure:
Field Value Name enrollment-prompt -
In the Fields section, move these to the Selected side:
default-source-enrollment-field-username(username)default-user-settings-field-email(email)default-password-change-field-password(password)default-password-change-field-password-repeat(password_repeat)
-
(Optional) In Validation policies, select
password-complexityif you created it in Step 4.2 -
Click Finish
Step 4.2: (Optional) Create Password Complexity Policy
-
Go to Customisation > Policies
-
Click Create and select Password Policy
-
Configure:
Field Value Name password-complexityPassword field passwordMinimum length 8Amount of uppercase characters 1Amount of lowercase characters 1Amount of digits 1 -
Click Finish
You'll add this to the enrollment prompt stage later.
Step 4.3: Create a Group for Kaboot Users
-
Go to Directory > Groups
-
Click Create
-
Configure:
Field Value Name kaboot-users -
Click Create
Step 4.4: Create the User Write Stage
-
Go to Flows and Stages > Stages
-
Click Create
-
Select User Write Stage and click Next
-
Configure:
Field Value Name enrollment-user-writeUser creation mode Create users when requiredCreate users as inactive Unchecked Group kaboot-users -
Click Finish
Step 4.5: Create the User Login Stage
-
Go to Flows and Stages > Stages
-
Click Create
-
Select User Login Stage and click Next
-
Configure:
Field Value Name enrollment-user-loginSession duration hours=24Stay signed in offset days=30Network binding No bindingGeoIP binding No binding -
Click Finish
Step 4.6: Create the Enrollment Flow
-
Go to Flows and Stages > Flows
-
Click Create
-
Configure:
Field Value Name Enrollment FlowTitle Sign UpSlug enrollment-flowDesignation EnrollmentAuthentication No requirement -
Click Create
-
Click on the newly created
enrollment-flow -
Go to the Stage Bindings tab
-
Click Bind existing stage and add stages in this order:
Stage Order enrollment-prompt10 enrollment-user-write20 enrollment-user-login30
Step 4.7: Bind the Group to the Kaboot Application
-
Go to Applications > Applications > Kaboot
-
Go to the Policy / Group / User Bindings tab
-
Click Bind existing group
-
Select
kaboot-users -
Click Bind
Now users in the kaboot-users group (which includes all users who sign up) will have access to Kaboot.
Step 4.8: Link Enrollment Flow to Login
-
Go to Flows and Stages > Stages
-
Find and click on
default-authentication-identification -
Scroll down to Flow settings
-
In the Enrollment flow dropdown, select
enrollment-flow -
Click Update
Now when users visit the login page, they'll see a "Need an account? Sign up." link.
Optional: Add Password Recovery
-
In Flows and Stages > Stages >
default-authentication-identification -
Set Recovery flow to
default-recovery-flow(if it exists) -
Click Update
Step 5: Verify OIDC Endpoints
After creation, go to Applications > Providers > Kaboot OAuth2
Note these endpoints (you'll need them for frontend configuration):
| Endpoint | URL |
|---|---|
| Issuer | http://localhost:9000/application/o/kaboot/ |
| Authorization | http://localhost:9000/application/o/authorize/ |
| Token | http://localhost:9000/application/o/token/ |
| UserInfo | http://localhost:9000/application/o/userinfo/ |
| JWKS | http://localhost:9000/application/o/kaboot/jwks/ |
Step 5: Test the Configuration
-
Open the OpenID Configuration URL in your browser:
http://localhost:9000/application/o/kaboot/.well-known/openid-configuration -
You should see a JSON response with all OIDC endpoints
Step 6: Create a Test User
Create a regular user for manual browser testing.
-
Go to Directory > Users
-
Click Create
-
Fill in user details:
Field Value Username kaboottestName Kaboot TestEmail kaboottest@test.com -
After creation, click on the user and go to the Credentials tab
-
Click Set password and set it to
kaboottest -
Bind the user to the Kaboot application:
- Go to Applications > Applications > Kaboot
- Click the Policy / Group / User Bindings tab
- Click Bind existing user
- Select
kaboottestand click Bind
Step 7: Create a Service Account for API Testing
Create a service account that can obtain tokens programmatically for automated tests.
-
Go to Directory > Users
-
Click Create Service Account
-
Fill in details:
Field Value Username kaboot-test-serviceCreate group Unchecked -
Click Create
-
Create an App Password for the service account:
- Click on the newly created
kaboot-test-serviceuser - Go to the App passwords tab
- Click Create App Password
- Name it
api-tests - Copy the generated password (you won't see it again!)
- Click on the newly created
-
Bind the service account to the Kaboot application:
- Go to Applications > Applications > Kaboot
- Click the Policy / Group / User Bindings tab
- Click Bind existing user
- Select
kaboot-test-serviceand click Bind
-
Save credentials to
server/.env.test:TEST_USERNAME=kaboot-test-service TEST_PASSWORD=<paste-app-password-here> -
Verify token generation works:
cd server npm run test:get-tokenYou should see "Token obtained successfully" and the access token printed.
Environment Variables
Ensure your .env file has the correct OIDC configuration:
OIDC_ISSUER=http://localhost:9000/application/o/kaboot/
OIDC_JWKS_URI=http://localhost:9000/application/o/kaboot/jwks/
For the frontend OIDC config (src/config/oidc.ts):
export const oidcConfig = {
authority: 'http://localhost:9000/application/o/kaboot/',
client_id: 'kaboot-spa',
redirect_uri: `${window.location.origin}/callback`,
// ... rest of config
};
Troubleshooting
"Invalid redirect URI" error
- Ensure all redirect URIs are added exactly as configured in the provider
- Check for trailing slashes - they must match exactly
"Client not found" error
- Verify the Client ID matches
kaboot-spa - Ensure the application is enabled (not archived)
CORS errors
- Authentik handles CORS automatically for configured redirect URIs
- Ensure your frontend origin (
http://localhost:5173) is in the redirect URIs
Token validation fails on backend
- Verify
OIDC_ISSUERandOIDC_JWKS_URIare correct - The backend must be able to reach Authentik at
http://authentik-server:9000(Docker network)
Production Notes
For production deployment:
- Use HTTPS everywhere
- Update all URLs from
localhostto your domain - Update redirect URIs in Authentik
- Update frontend OIDC config with production URLs
- Update
.envwith production OIDC endpoints - Consider enabling Authentik error reporting
- Configure email settings in Authentik for password recovery