Single Sign-On (SSO)
Enable social authentication with Google, Discord, Facebook, or custom OAuth2 providers in VitNode.
VitNode provides built-in OAuth2 single sign-on. Register an adapter in your API configuration, and authentication buttons automatically appear on /login and /register.
Quick start
Register an SSO adapter in apps/api/src/vitnode.api.config.ts:
import { GoogleSSOApiPlugin } from "@vitnode/core/api/adapters/sso/google"
import { buildApiConfig } from "@vitnode/core/vitnode.config"
export const vitNodeApiConfig = buildApiConfig({
authorization: {
ssoAdapters: [
GoogleSSOApiPlugin({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
}),
],
},
})A Continue with Google button automatically renders on your login and registration forms.
Supported Providers
Google Cloud Console setup with OpenID email verification
Discord
Discord Developer Portal with identify and email scopes
Meta Developers app with Facebook Login
Custom OAuth2 Adapter
Connect GitHub, Apple, or any OAuth2 provider
Callback URLs
When configuring OAuth2 applications in provider developer consoles, use the following redirect URI pattern:
https://your-domain.com/login/sso/{provider_id}For example: https://your-domain.com/login/sso/google.
How Accounts Link
When a user signs in via SSO:
- Existing Email Match: If an existing account shares the verified email, the SSO identity is automatically linked.
- New Visitor: A new user is created with their social display name, email, and avatar.