Getting Started
Installation
Get started with nuxt-oidc-auth
Quick Start
Add nuxt-oidc-auth dependency to your project
Using nuxi
pnpm dlx nuxi@latest module add nuxt-oidc-auth
yarn dlx nuxi@latest module add nuxt-oidc-auth
npx nuxi@latest module add nuxt-oidc-auth
Or manually installing
pnpm add nuxt-oidc-auth
yarn add nuxt-oidc-auth
npm install nuxt-oidc-auth
Configure provider
Configure one of the predefined providers in your nuxt.config.ts under oidc.providers and inject credentials through environment variables.
nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-oidc-auth'],
oidc: {
providers: {
github: {
redirectUri: 'http://localhost:3000/auth/github/callback',
clientId: '',
clientSecret: '',
},
},
},
})
.env
NUXT_OIDC_PROVIDERS_GITHUB_CLIENT_ID=CLIENT_ID
NUXT_OIDC_PROVIDERS_GITHUB_CLIENT_SECRET=CLIENT_SECRET
Need a minimal provider-first setup? Use Provider quickstarts.
For stable sessions across restarts and production environments, configure the module secrets.
Play on StackBlitz
