Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nuxt-alt/auth/llms.txt

Use this file to discover all available pages before exploring further.

Providers are pre-configured strategy presets that wire up endpoints, scopes, token settings, and scheme defaults for popular authentication backends. Instead of manually specifying every endpoint URL and option, you pick a provider and supply only the secrets and overrides specific to your app. Providers are imported from the #auth/providers virtual module and take effect at build time through the Nuxt module.

How Providers Work

Each provider is a function that receives your partial strategy config and merges sensible defaults onto it before the module finalises its build-time configuration. Importing a provider does not add any runtime overhead — the merge happens during the Nuxt build.
import { github } from '#auth/providers'
// Internally the provider pre-fills:
// endpoints.authorization = 'https://github.com/login/oauth/authorize'
// endpoints.token         = 'https://github.com/login/oauth/access_token'
// endpoints.userInfo      = 'https://api.github.com/user'
// scope                   = ['user', 'email']
// scheme                  = 'oauth2'
// … and more OAuth2 defaults
You do not call the provider function yourself. The module detects known provider names in your strategies config and applies the matching provider automatically.

Available Providers

Auth0

Auth0 OAuth2 with authorization code flow, PKCE, and the Auth0 userinfo endpoint.

GitHub

GitHub OAuth2 authorization code flow with server-side token exchange via a Nuxt API route.

Google

Google OAuth2 with the Google OAuth2 v3 API userinfo endpoint.

Facebook

Facebook Login via OAuth2 and the Facebook Graph API.

Discord

Discord OAuth2 with PKCE (S256) and the Discord users/@me endpoint.

Laravel Sanctum

Cookie-based session auth with CSRF protection for Laravel Sanctum.

Laravel Passport

Laravel Passport OAuth2 — supports authorization code and password grant flows.

Laravel JWT

Token-based authentication with Laravel JWT and automatic refresh support.

Configuring a Provider

Because providers auto-fill defaults, your nuxt.config.ts only needs the strategy name (which must match a known provider) plus the credentials and any overrides you want.
export default defineNuxtConfig({
  auth: {
    strategies: {
      github: {
        clientId: 'YOUR_CLIENT_ID',
        clientSecret: 'YOUR_CLIENT_SECRET',
      },
      discord: {
        clientId: 'YOUR_CLIENT_ID',
        clientSecret: 'YOUR_CLIENT_SECRET',
      },
    },
  },
})
The scheme, endpoint URLs, default scopes, and token settings are all applied automatically. You can still override any individual field — values you provide always take precedence over the provider defaults.
Strategy names must match a known provider identifier for auto-configuration to apply. The recognised names are auth0, github, google, facebook, discord, laravelSanctum, laravelPassport, and laravelJWT. The aliases laravel/sanctum, laravel/passport, and laravel/jwt are also supported and are normalised to their camelCase equivalents at build time.

Build docs developers (and LLMs) love