Skip to main content

OAuth Setup

CleverThis supports Google and GitHub OAuth for user sign-in. Each provider requires creating an OAuth application in the provider's developer console and configuring the resulting credentials as environment variables.

Google OAuth

  1. Go to Google Cloud Console → APIs & Services → Credentials.
  2. Click Create Credentials → OAuth client ID.
  3. Choose Web application.
  4. Set Authorized JavaScript origins to your webapp URL: https://app.your-domain.com.
  5. Set Authorized redirect URIs to: https://app.your-domain.com/api/auth/callback/google
  6. Click Create. Copy the Client ID and Client secret.

Set environment variables:

GOOGLE_CLIENT_ID=<your-client-id>
GOOGLE_CLIENT_SECRET=<your-client-secret>

GitHub OAuth

  1. Go to GitHub → Settings → Developer settings → OAuth Apps → New OAuth App.
  2. Set Application name to anything (e.g. "CleverThis").
  3. Set Homepage URL to https://app.your-domain.com.
  4. Set Authorization callback URL to: https://app.your-domain.com/api/auth/callback/github
  5. Click Register application. On the next page, click Generate a new client secret.
  6. Copy the Client ID and the generated Client secret.

Set environment variables:

GITHUB_CLIENT_ID=<your-client-id>
GITHUB_CLIENT_SECRET=<your-client-secret>

Enabling / disabling providers

If only one provider's environment variables are set, only that provider's OAuth button appears on the sign-in page. To disable OAuth entirely (email/password only), omit both sets of variables.

Testing OAuth locally

For local development, set the redirect URL to http://localhost:3000/api/auth/callback/google (or /github). Most providers allow multiple redirect URIs on the same OAuth app.

Coming soon

SAML/SSO for enterprise organization workspaces is on the roadmap.