OAuth Component

The OAuth component in servercn provides a unified way to integrate third-party authentication into your backend.

Instead of installing providers individually, this component bundles strategies for:

  • Google OAuth
  • Facebook OAuth
  • GitHub OAuth

All under a single, consistent architecture.


Installation Guide

npx servercn-cli add oauth
npx servercn-cli add oauth
 
? Select OAuth provider:  » - Use arrow-keys. Return to submit.
> Google
  GitHub
  Facebook
  Google + GitHub
  GitHub + Facebook
  Google + Facebook
  Google + Facebook + GitHub

Environment Variables

Configure each provider in your .env file:

Google

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CALLBACK_URL=

Facebook

FACEBOOK_APP_ID=
FACEBOOK_APP_SECRET=
FACEBOOK_REDIRECT_URI=

GitHub

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=
google
github
facebook
google-github
github-facebook
google-facebook
google-facebook-github

File & Folder Structure

Loading files...

Installation

npx servercn-cli add oauth