- Access the Authentik admin interface (e.g.,
https://auth.example.com/if/admin
). - Log in with your admin credentials.
- Go to Providers in the left-hand menu.
- Click Create Provider.
- Choose OAuth2/OpenID Connect Provider as the provider type.
- Set the following fields:
- Name:
unifi-voucher-provider
. - Authentication flow:
default-authentication-flow
. - Authorization flow:
default-provider-authorization-implicit-consent
. - Client Type: Select
confidential
, A client secret will be generated.
- Name:
- Set the Redirect URI to match your UniFi Voucher Site’s callback URL (e.g.,
https://voucher.example.com/oidc/callback
). - Click Submit.
After saving, note down the Client ID and Client Secret generated for this provider. You’ll need it when configuring your UniFi Voucher Site.
- Go to Applications in the left-hand menu.
- Click Create Application.
- Fill in the following fields:
- Name:
UniFi Voucher
(You can choose any relevant name). - Slug: This is a URL-friendly identifier (e.g.,
unifi-voucher
). - Provider: Select the provider you created in step 2 (e.g.,
unifi-voucher-provider
).
- Name:
- Click Submit to save.
Now, configure your UniFi Voucher Site to use the Authentik client.
- In your UniFi Voucher Site configuration, set
AUTH_OIDC_ENABLED
totrue
. - Set the
AUTH_OIDC_CLIENT_ID
as configured in Authentik (found in the Authentik provider configuration). - Provide the
AUTH_OIDC_CLIENT_SECRET
(found in the Authentik provider configuration). - Provide the
AUTH_OIDC_ISSUER_BASE_URL
from your Authentik provider.- You can find this under Providers > unifi-voucher-provider > OpenID Configuration URL in Authentik.
- Provide the
AUTH_OIDC_APP_BASE_URL
from your UniFi Voucher Site instance (e.g.,https://voucher.example.com
). - Restart the container after these changes
- Test the login flow from your UniFi Voucher Site. Ensure it redirects to Authentik for authentication.
- After logging in, the user should be redirected back to the voucher site with the appropriate tokens.
- Invalid Redirect URI: Ensure the callback URI matches what is configured in Authentik.
- Client Secret Errors: Double-check the client secret in both Authentik and your UniFi configuration.