OAuth Providers
Zipline supports OAuth authentication with multiple providers:- GitHub
- Discord
- OpenID Connect (OIDC)
GET /api/auth/oauth
Retrieve all OAuth providers connected to the authenticated user’s account.Authentication
This endpoint requires authentication.Response
Array of OAuth provider objects connected to the user
Example Request
Example Response
DELETE /api/auth/oauth
Remove an OAuth provider from the authenticated user’s account.Authentication
This endpoint requires authentication.Request Body
The OAuth provider to remove:
DISCORD, GOOGLE, GITHUB, or OIDCResponse
Returns the updated array of OAuth providers after removal.Validation Rules
- Cannot delete the last OAuth provider if the user has no password set
- User must have at least one authentication method (OAuth or password)
Error Responses
400 Bad Request- No providers to delete400 Bad Request- You can’t delete your last oauth provider without a password401 Unauthorized- No active session or invalid authentication
Example Request
Example Response
OAuth Authentication Endpoints
GET /api/auth/oauth/github
Initiate or complete GitHub OAuth authentication flow.Query Parameters
OAuth authorization code (provided by GitHub after user authorization)
Optional state parameter. Use
link to link an OAuth provider to an existing account.Behavior
- Without code: Redirects to GitHub authorization page
- With code: Exchanges code for access token and creates/links account
GET /api/auth/oauth/discord
Initiate or complete Discord OAuth authentication flow.Query Parameters
OAuth authorization code (provided by Discord after user authorization)
Optional state parameter. Use
link to link an OAuth provider to an existing account.Additional Features
- Supports
allowedIdsanddeniedIdsconfiguration for access control - Fetches user avatar from Discord CDN
GET /api/auth/oauth/google
Initiate or complete Google OAuth authentication flow.Query Parameters
OAuth authorization code (provided by Google after user authorization)
Optional state parameter. Use
link to link an OAuth provider to an existing account.Scopes
- User profile information
- Email address (used as fallback username)
GET /api/auth/oauth/oidc
Initiate or complete OpenID Connect OAuth authentication flow.Query Parameters
OAuth authorization code (provided by OIDC provider after user authorization)
Optional state parameter. Use
link to link an OAuth provider to an existing account.Configuration Required
clientId- OIDC client IDclientSecret- OIDC client secretauthorizeUrl- Authorization endpoint URLtokenUrl- Token endpoint URLuserinfoUrl- User info endpoint URL
Username Resolution
The username is determined from OIDC claims in this order:preferred_usernamenamegiven_nameemailsub
OAuth Flow
- Initiate: User clicks OAuth login button
- Redirect: User is redirected to provider’s authorization page
- Authorize: User authorizes the application
- Callback: Provider redirects back with authorization code
- Exchange: Server exchanges code for access token
- User Info: Server fetches user information from provider
- Account: Server creates new account or links to existing account
- Session: Server creates session and logs user in
Configuration Requirements
OAuth registration must be enabled in the server configuration (features.oauthRegistration). Each provider also requires specific configuration:
- GitHub:
clientId,clientSecret, optionalredirectUri - Discord:
clientId,clientSecret, optionalredirectUri, optionalallowedIds/deniedIds - Google:
clientId,clientSecret, optionalredirectUri - OIDC:
clientId,clientSecret,authorizeUrl,tokenUrl,userinfoUrl, optionalredirectUri
Error Responses
403 Forbidden- OAuth registration is disabled401 Unauthorized- Provider is not configured400 Bad Request- Failed to fetch access token400 Bad Request- Failed to fetch user information400 Bad Request- User not allowed (Discord with allowedIds/deniedIds)