Single Sign-On (SSO)

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:

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


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.


When a user signs in via SSO:

  1. Existing Email Match: If an existing account shares the verified email, the SSO identity is automatically linked.
  2. New Visitor: A new user is created with their social display name, email, and avatar.

Learn More