fix: separate Authentik application slug from OAuth client ID

Authentik uses different values for:
- OAuth Client ID (UUID for authentication)
- Application Slug (URL-friendly identifier like 'headquarter-web')

Add AUTHENTIK_APPLICATION_SLUG config to build correct Authentik URLs
while keeping AUTHENTIK_CLIENT_ID for OAuth token exchange.
This commit is contained in:
Fusion
2026-05-18 21:46:54 +02:00
parent 137757602f
commit 0509b9eb4a
3 changed files with 11 additions and 2 deletions
+5 -2
View File
@@ -34,6 +34,9 @@ class Settings(BaseSettings):
# Authentik configuration - no hardcoded URLs
authentik_client_id: str = "headquarter-web"
authentik_client_secret: str = "change-me"
# Authentik application slug used in URLs (e.g., "headquarter-web")
# This is different from the OAuth client_id which may be a UUID
authentik_application_slug: str = "headquarter-web"
authentik_authorize_url: str | None = None
authentik_token_url: str | None = None
authentik_jwks_url: str | None = None
@@ -100,13 +103,13 @@ class Settings(BaseSettings):
def resolved_authentik_jwks_url(self) -> str:
if self.authentik_jwks_url:
return self.authentik_jwks_url
return f"{self.authentik_base_url}/application/o/{self.authentik_client_id}/jwks/"
return f"{self.authentik_base_url}/application/o/{self.authentik_application_slug}/jwks/"
@property
def resolved_authentik_issuer(self) -> str:
if self.authentik_issuer:
return self.authentik_issuer
return f"{self.authentik_base_url}/application/o/{self.authentik_client_id}/"
return f"{self.authentik_base_url}/application/o/{self.authentik_application_slug}/"
@property
def cookie_secure(self) -> bool: