Expand description
Generic OAuth2 provider support.
Config-driven: no provider-specific code branches. Any OAuth2 provider (GitHub, GitLab, Gitea, OIDC-compatible) can be added via configuration.
This module contains only types, URL builders, and JSON parsing. No HTTP calls or DB access — those live in the backend adapters.
Structs§
- Auth
Providers Response - Available auth providers (returned by GET /api/auth/providers).
- Linked
Provider - A linked OAuth provider shown in user settings.
- OAuth
Field Map - Maps provider-specific JSON field names to our internal fields.
- OAuth
Provider Config - OAuth2 provider configuration. Loaded from environment variables or config file.
- OAuth
Provider Info - Public info about an OAuth provider.
- OAuth
User Info - Normalized user info extracted from any OAuth provider’s userinfo response.
Functions§
- build_
authorize_ url - Build the OAuth authorize URL that the user’s browser should be redirected to.
- build_
token_ request_ body - Build the JSON body for the token exchange request.
- extract_
user_ info - Extract normalized user info from a provider’s userinfo JSON response.
- github_
preset - Create a GitHub OAuth2 provider config. Only needs client credentials.
- gitlab_
preset - Create a GitLab OAuth2 provider config for a given instance URL.