OAuth 2.0
For human users
Google Workspace OAuth with PKCE for secure sign-in. Domain restrictions ensure only authorized users can access.
Rack Gateway uses a multi-layered authentication system combining OAuth 2.0 for identity, session tokens for authorization, and multi-factor authentication, which is required for every user by default.
OAuth 2.0
For human users
Google Workspace OAuth with PKCE for secure sign-in. Domain restrictions ensure only authorized users can access.
API Tokens
For automation
Long-lived tokens for CI/CD pipelines, scripts, and integrations. Each token has its own permissions, limited by its owner’s role.
The gateway supports two authentication channels:
| Aspect | Web Browser | CLI |
|---|---|---|
| OAuth Flow | Standard code flow | PKCE code flow |
| Session Storage | HTTP-only cookie | Local config file |
| Session Lifetime | Ends after inactivity (default 5 min) | 90 days |
| MFA | Browser-based prompts | Terminal prompts |
| CSRF Protection | Required (cookie-based) | Not needed (token-based) |
rack-gateway login; the CLI listens on http://127.0.0.1:<random port>/callback~/.config/rack-gateway/config.jsonSee OAuth Flow for details.
Sessions are the primary authentication mechanism after initial OAuth:
See Sessions for details.
Only users from your Google Workspace domain can authenticate:
# Environment variableGOOGLE_ALLOWED_DOMAIN=yourcompany.comUsers from other domains receive an error during OAuth callback.
The gateway verifies that:
Session tokens are never stored in plaintext:
Stored: SHA-256(session_token)Client: session_token (raw)Even if the database is compromised, tokens cannot be recovered.
Web requests require CSRF tokens to prevent cross-site request forgery:
MFA adds a second factor after OAuth authentication:
MFA is required for every user by default (mfa_require_all_users). With that setting off, users who haven’t
enrolled can sign in to the web UI without MFA, but the CLI still requires every user to enroll. Either way, actions
that need MFA ask for it (see MFA Requirements).
See MFA Overview for setup details.
| Characteristic | Session (Human) | API Token (Automation) |
|---|---|---|
| Creation | OAuth flow | Created in the web UI or with rack-gateway api-token create (deployers for themselves, admins for anyone) |
| Lifetime | Web: idle timeout; CLI: 90 days from last use | Until deleted or its optional expiry |
| Revocation | Logout (web or rack-gateway logout), or revoking it from the user’s sessions | Delete token |
| MFA | Required | N/A (limited by permissions instead) |
| CSRF | Required (web) | Not required |
| Use Case | Interactive access | CI/CD, scripts |
Key authentication settings:
| Setting | Description | Default |
|---|---|---|
GOOGLE_CLIENT_ID | OAuth client ID | Required |
GOOGLE_CLIENT_SECRET | OAuth client secret | Required |
GOOGLE_ALLOWED_DOMAIN | Allowed email domain | Required |
APP_SECRET_KEY | Secret for sessions/CSRF | Required |
RGW_SETTING_SESSION_TIMEOUT_MINUTES | Idle session timeout | 5 |
See Configuration for complete reference.
GOOGLE_ALLOWED_DOMAIN set to your domainAPP_SECRET_KEY is strong and unique