Skip to main content

OAuth Flow

Aurora uses OAuth 2.0 for secure authentication with cloud providers. Each provider implements OAuth differently.

Supported OAuth Providers

Google Cloud Platform

OAuth 2.0 with consent screen

Tailscale

OAuth client credentials flow

OVH Cloud

OAuth 2.0 with custom scopes

Microsoft Azure

Service principal (client credentials)

Google Cloud Platform OAuth

GCP uses standard OAuth 2.0 authorization code flow.

Flow Diagram

1. Initiate OAuth Flow

POST /gcp/login
Response:
Redirect user to login_url:
  • User authenticates with Google
  • Reviews requested permissions
  • Grants consent
  • Google redirects to Aurora callback

3. Callback & Token Exchange

GET /gcp/callback Google redirects with:
  • code - Authorization code
  • state - User ID (for security)
Aurora:
  1. Validates state parameter
  2. Exchanges code for tokens
  3. Stores tokens in Vault
  4. Triggers post-auth setup
  5. Redirects to frontend
Redirect URL:

4. Post-Auth Setup

Asynchronous setup tasks:
  1. Fetch user’s GCP projects
  2. Enable required APIs
  3. Create service accounts
  4. Configure IAM permissions
  5. Set up billing exports
  6. Initialize project metadata
  7. Complete setup
Poll Status:
Progress Response:
Complete Response:

OAuth Scopes

GCP OAuth requires:
  • https://www.googleapis.com/auth/cloud-platform - Full cloud platform access
  • https://www.googleapis.com/auth/compute - Compute Engine
  • https://www.googleapis.com/auth/cloudresourcemanager - Project management

Token Management

  • Access Token - Short-lived (1 hour), used for API calls
  • Refresh Token - Long-lived, used to get new access tokens
  • Expiration - Stored in database (expires_at field)
  • Refresh - Automatic when access token expires

Tailscale OAuth

Tailscale uses OAuth 2.0 client credentials flow.

Flow Diagram

Client Credentials Flow

POST /tailscale_api/tailscale/connect
Aurora:
  1. Requests access token from Tailscale
  2. Validates token by fetching devices
  3. Stores credentials in Vault
  4. Generates SSH key pair
  5. Creates reusable auth key
Response:

Token Refresh

POST /tailscale_api/tailscale/refresh-token Manually refresh access token:

OAuth Scopes

Tailscale scopes:
  • devices - Read device information
  • devices:write - Manage devices
  • acl - Read ACL configuration
  • acl:write - Modify ACL
  • keys - Manage auth keys

Azure Service Principal

Azure uses service principal authentication (similar to OAuth client credentials).

Flow Diagram

Service Principal Authentication

POST /azure/login
Aurora:
  1. Creates ClientSecretCredential
  2. Requests management token
  3. Validates by fetching subscriptions
  4. Stores credentials in Vault
Response:

Token Expiration

  • Access tokens expire after 1 hour
  • Automatically refreshed on API calls
  • Uses stored service principal credentials
  • No manual refresh required

OAuth Security

State Parameter

Prevents CSRF attacks:

External ID (AWS)

Adds security layer for role assumption:
  • Each workspace has unique external ID
  • Prevents confused deputy problem
  • Required for role assumption

Token Storage

HashiCorp Vault:

Credential Rotation

GCP:
  • Access tokens expire after 1 hour
  • Refresh tokens used to get new access tokens
  • Refresh tokens rotated on use (optional)
AWS:
  • STS credentials expire after 1 hour (default)
  • Automatically re-assumed on expiration
  • External ID never changes
Azure:
  • Access tokens expire after 1 hour
  • Client secrets expire after configured period
  • No automatic rotation (manual renewal required)
Tailscale:
  • Access tokens expire after 90 days (default)
  • Manual refresh via /tailscale/refresh-token
  • Client credentials never expire

Error Handling

OAuth Errors

Invalid Grant:
Action: Restart OAuth flow Access Denied:
Action: Inform user, allow retry Invalid Client:
Action: Verify Aurora OAuth configuration

Token Refresh Errors

Refresh Token Expired:
Action: Trigger re-authentication Network Error:

Best Practices

Frontend Implementation

Secure Callback Handling

Token Refresh