Overview
Unla supports user login through third-party OAuth services, currently supportingGoogle
and GitHub
login methods. Users can quickly log in to the Unla Web interface using their existing Google or GitHub accounts without needing to register separately.
Google Login
Quick login using Google account
GitHub Login
Quick login using GitHub account
Prerequisites
Before configuring OAuth login, you need to create OAuth applications with the respective service providers:1
Google Cloud Console
Create OAuth 2.0 client ID in Google Cloud Console
2
GitHub Settings
Create OAuth application in GitHub
3
Configure Callback URLs
Configure correct callback URLs for each OAuth application
Google OAuth Configuration
1. Create Google OAuth Application
1
Access Google Cloud Console
Visit Google Cloud Console and log in to your account
2
Create or Select Project
Create a new project or select an existing project
3
Enable Google+ API
Enable Google+ API in APIs & Services
4
Create OAuth Client ID
Create OAuth 2.0 client ID in the Credentials page, select “Web application” type
5
Configure Authorization Callback URL
Add to “Authorized redirect URIs”:
2. Obtain Credentials
After creation, you will get:- Client ID: Used for
client_id
configuration - Client Secret: Used for
client_secret
configuration
3. Configure apiserver.yaml
Add Google OAuth configuration to theapiserver.yaml
configuration file:
It’s recommended to use environment variables to manage sensitive information:
GitHub OAuth Configuration
1. Create GitHub OAuth Application
1
Access GitHub Settings
Go to GitHub Settings → Developer settings → OAuth Apps
2
Create New Application
Click “New OAuth App” to create a new OAuth application
3
Fill Application Information
- Application name: Unla Web
- Homepage URL: https://your-domain.com
- Authorization callback URL: https://your-domain.com/api/auth/github/callback
4
Register Application
Click “Register application” to complete creation
2. Obtain Credentials
After creation, you will get:- Client ID: Used for
client_id
configuration - Client Secret: Need to generate, used for
client_secret
configuration
3. Configure apiserver.yaml
Add GitHub OAuth configuration to theapiserver.yaml
configuration file:
It’s recommended to use environment variables to manage sensitive information:
Complete Configuration Example
Here’s a complete OAuth configuration example:Callback URL Configuration
Ensure correct callback URLs are configured in the OAuth applications:Important Notes:
- Callback URLs must match your deployed Unla service domain
- Use HTTPS in production environments
- Don’t hardcode sensitive information in code, use environment variables
Features
Automatic Account Creation
- Users logging in via OAuth for the first time will have accounts created automatically
- User information (username, email, avatar) will be synced from the OAuth provider
- Subsequent logins will automatically link to the created account
Account Association
- Supports multiple login methods coexisting (local accounts + OAuth)
- Users can use both local password and OAuth login
- Administrator account functionality is unaffected
Security
- All OAuth processes follow standard OAuth 2.0 protocol
- Sensitive information (like access tokens) is only processed server-side
- Supports HTTPS encrypted transmission
FAQ
OAuth login options not showing
OAuth login options not showing
Check if
client_id
and client_secret
are properly configured. Login options only appear when the corresponding parameters are configured.Callback errors or unable to login
Callback errors or unable to login
Ensure the callback URL configured in the OAuth application matches the actual deployed domain, including protocol (http/https) and port.
User information sync issues
User information sync issues
User information is automatically synced on first login. For re-sync, contact administrator or re-login.
How to disable OAuth login
How to disable OAuth login
Delete or comment out the corresponding OAuth configuration in
apiserver.yaml
to disable the respective login option.Environment Variable Reference
Variable Name | Description | Example |
---|---|---|
OAUTH_GOOGLE_CLIENT_ID | Google OAuth Client ID | 123456789.apps.googleusercontent.com |
OAUTH_GOOGLE_CLIENT_SECRET | Google OAuth Client Secret | GOCSPX-abc123def456 |
OAUTH_GITHUB_CLIENT_ID | GitHub OAuth Client ID | Iv1.abc123def456 |
OAUTH_GITHUB_CLIENT_SECRET | GitHub OAuth Client Secret | abc123def456ghi789 |