Skip to main content
Gately supports OAuth authentication with Google and GitHub, allowing users to sign in with their existing accounts.

Google Login

Options

Example

React Component

GitHub Login

Options

Example

React Component

OAuth Flow

  1. User clicks social login button
  2. SDK redirects to OAuth provider (Google/GitHub)
  3. User authorizes your application
  4. Provider redirects back with auth code
  5. SDK exchanges code for session
  6. User is logged in and redirected

Configuration

Enable OAuth Providers

  1. Go to Settings > Authentication in your dashboard
  2. Enable Google and/or GitHub
  3. Add your OAuth credentials

Google Setup

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable Google+ API
  4. Create OAuth 2.0 credentials
  5. Add authorized redirect URI: https://api.usegately.com/api/v1/sso/google/callback
  6. Copy Client ID and Client Secret to Gately

GitHub Setup

  1. Go to GitHub Developer Settings
  2. Create a new OAuth App
  3. Set Authorization callback URL: https://api.usegately.com/api/v1/sso/github/callback
  4. Copy Client ID and Client Secret to Gately

Custom Domain

If you have a custom domain configured:

Handling OAuth Redirect

The SDK automatically handles OAuth redirects. After successful authentication:
  1. Session is saved to localStorage
  2. Cookies are set for cross-origin requests
  3. gately:auth-success event is dispatched
  4. User is redirected to redirectTo URL

Error Handling

User Data from OAuth

OAuth providers return user profile data:

Google

GitHub

Linking Accounts

If a user signs up with email and later tries to login with OAuth using the same email, the accounts are automatically linked.