Skip to main content

OpenID Provider Configuration

The custom scope​

pk, is_superuser and attributes are not standard OIDC claims, but the app reads all three, so they come through a custom scope.

  1. Customization → Property Mappings
  2. Create → Scope Mapping
  3. Name People Portal Scope, scope name people_portal
  4. Expression:
script.py
return {    "pk": request.user.pk,    "is_superuser": request.user.is_superuser,    "attributes": request.user.attributes}

If this mapping is ever detached, is_superuser arrives undefined and reads as false, which looks like a permissions bug rather than a configuration one.

Application and provider​

  1. Applications → Applications → Create with Provider, name it People Portal
  2. Provider type OAuth2/OpenID Provider
  3. Authorization flow: default-provider-authorization-implicit-consent
  4. Invalidation flow: default-invalidation-flow
  5. Client type confidential. Note the client id and secret
  6. Under Advanced protocol settings, set the scopes from the warning above, and set Subject mode to Based on the User's username
  7. Grant types: authorization_code and refresh_token

Without the explicit grant types, /authorize answers Invalid grant_type with nothing else to go on.

Redirect URIs​

Two entries, and the types are not interchangeable:

URLType
PEOPLEPORTAL_BASE_URL/api/auth/redirectauthorization
PEOPLEPORTAL_BASE_URL/logout

Both strict matching. Authentik validates post_logout_redirect_uri only against entries typed logout. Registering the landing page with the default authorization type is accepted by the API without complaint and then fails at logout with a bare "Bad Request — The request is otherwise malformed", naming neither the URI nor the type.

An unauthenticated probe of the end-session endpoint will not catch this: with no session it redirects to the authentication flow before the redirect URI is ever validated. Only a real logout exercises it.

Environment variables​

  • PEOPLEPORTAL_OIDC_CLIENTID — client id from step 5
  • PEOPLEPORTAL_OIDC_CLIENTSECRET — client secret from step 5
  • PEOPLEPORTAL_OIDC_DSCVURL — discovery URL from Applications → People Portal

Copyright © 2026 Atheesh Thirumalairajan