Skip to main content
OAuth Init Logo

What is OAuth Init?

OAuth Init is an interactive CLI tool that eliminates the pain of setting up OAuth providers for your web applications. Instead of manually navigating through multiple console pages, copying IDs, and managing credentials across different platforms, OAuth Init walks you through the entire process step-by-step. The CLI automatically detects your authentication library (next-auth, better-auth, lucia, arctic, etc.), suggests the correct callback URLs, opens the right console pages, validates your inputs, and saves credentials wherever you need them.

Key Features

Smart Detection

Automatically detects your auth library and suggests appropriate callback URLs for next-auth, better-auth, lucia, arctic, and more

Interactive Setup

Beautiful CLI interface powered by @clack/prompts guides you through each step with clear instructions and validation

Multiple Providers

Support for Google OAuth 2.0, GitHub Apps, GitHub OAuth Apps, and Discord OAuth with more providers coming soon

Flexible Output

Save credentials to .env, .env.local, JSON files, or print directly to console - your choice

GCP Integration

Seamlessly integrates with gcloud CLI to fetch your Google Cloud projects and streamline OAuth setup

CI/CD Ready

Non-interactive mode with —no-open flag for automated environments and CI pipelines

Supported OAuth Providers

Google OAuth 2.0

Full integration with Google Cloud Console including project selection and consent screen setup

GitHub Apps

One-click GitHub App creation using manifest flow with automatic credential exchange

GitHub OAuth Apps

Traditional OAuth App setup with guided form completion

Discord OAuth

Discord Developer Portal integration with application creation and redirect configuration

Supported Auth Libraries

OAuth Init automatically detects and configures callback URLs for popular authentication libraries:
  • next-auth - /api/auth/callback/[provider]
  • @auth/core - /api/auth/callback/[provider]
  • better-auth - /api/auth/callback/[provider]
  • lucia - /auth/callback
  • arctic - /auth/callback/[provider]
  • iron-session - /api/auth/callback
If no auth library is detected, OAuth Init uses a generic callback pattern: /oauth/callback/[provider]

How It Works

The CLI orchestrates OAuth setup through a carefully designed workflow:
1

Discovery

Detects your project’s authentication library from package.json and determines the appropriate callback URL pattern
2

Provider Selection

Presents an interactive multi-select menu to choose which OAuth providers you want to configure
3

Guided Setup

For each provider, opens the correct console pages and provides step-by-step instructions with validation
4

Credential Capture

Collects client IDs and secrets with format validation to ensure correct configuration
5

Save

Writes credentials to your chosen format (.env, .env.local, JSON, or console output)

Quick Example

Here’s what the OAuth Init CLI looks like in action:
$ oauth-init

  ▗▄▖  ▗▄▖ ▗▖ ▗▖▗▄▄▄▖▗▖ ▗▖    ▗▄▄▄▖▗▖  ▗▖▗▄▄▄▖▗▄▄▄▖
 ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌  ▐▌ ▐▌  ▐▛▚▖▐▌
 ▐▌ ▐▌▐▛▀▜▌▐▌ ▐▌  ▐▛▀▜▌  ▐▌ ▝▜▌
 ▝▚▄▞▘▐▌ ▐▌▝▚▄▞▘  ▐▌ ▐▌    ▗▄█▄▖▐▌  ▐▌▗▄█▄▖ 

  Enter the name of your project:
  my-awesome-app

  Detected auth library: next-auth

  Select OAuth services to setup:
 Google
 Github
 Discord

  GitHub OAuth Setup

  What type of GitHub app you want to create?
 GitHub App (One click setup)
 OAuth App (You need to fill a form for this)

  Opening GitHub with your manifest...

  Credentials received!

  Where do you want to save the credentials?
 .env
 .env.local
 .json
 print to the console

  Credentials saved to .env

  OAuth setup completed! Thank you for using oauth-init!

Get Started

Ready to simplify your OAuth setup? Head over to the Installation guide to get started, or jump straight to the Quickstart tutorial to configure your first provider.

Installation

Install OAuth Init globally via npm, bun, or pnpm

Quickstart

Follow a step-by-step tutorial to set up your first OAuth provider

Build docs developers (and LLMs) love