Configuration
app.config.ts and runtimeConfig reference for @xenterprises/nuxt-x-auth-local.
Configuration
app.config.ts
export default defineAppConfig({
xAuth: {
tokens: {
accessCookie: 'x_auth_access', // cookie name for access token
refreshCookie: 'x_auth_refresh', // cookie name for refresh token
hasRefresh: true, // set false if your API has no refresh token
},
redirects: {
login: '/auth/login',
signup: '/auth/signup',
afterLogin: '/',
afterSignup: '/',
afterLogout: '/auth/login',
forgotPassword: '/auth/forgot-password',
},
features: {
forgotPassword: true,
signup: true,
},
ui: {
showLogo: true,
logoUrl: '',
brandName: 'My App',
tagline: '',
layout: 'centered', // 'centered' | 'split'
background: {
type: 'gradient', // 'gradient' | 'image' | 'solid'
imageUrl: '',
overlayOpacity: 50,
},
card: {
glass: false,
glassIntensity: 'medium', // 'subtle' | 'medium' | 'strong'
},
split: {
heroPosition: 'left', // 'left' | 'right'
heroImageUrl: '',
headline: '',
subheadline: '',
features: [],
},
},
},
})
Schema Reference
| Key | Type | Default | Description |
|---|---|---|---|
tokens.accessCookie | string | 'x_auth_access' | Cookie name for storing the access token. |
tokens.refreshCookie | string | 'x_auth_refresh' | Cookie name for storing the refresh token. |
tokens.hasRefresh | boolean | true | Set false if your API does not issue a refresh token. |
redirects.login | string | '/auth/login' | Path of the login page. |
redirects.signup | string | '/auth/signup' | Path of the signup page. |
redirects.afterLogin | string | '/' | Redirect destination after a successful login. |
redirects.afterSignup | string | '/' | Redirect destination after a successful signup. |
redirects.afterLogout | string | '/auth/login' | Redirect destination after logout. |
redirects.forgotPassword | string | '/auth/forgot-password' | Path of the forgot-password page. |
features.forgotPassword | boolean | true | Enable forgot-password flow. |
features.signup | boolean | true | Enable signup page and link. |
ui.showLogo | boolean | true | Show logo in auth forms. |
ui.logoUrl | string | '' | Logo image URL. |
ui.brandName | string | 'My App' | Brand name displayed in auth forms. |
ui.tagline | string | '' | Tagline displayed below brand name. |
ui.layout | 'centered' | 'split' | 'centered' | Auth page layout style. |
ui.background.type | 'gradient' | 'image' | 'solid' | 'gradient' | Background style for auth pages. |
ui.background.imageUrl | string | '' | Background image URL (when type is 'image'). |
ui.background.overlayOpacity | number | 50 | Background overlay opacity (0–100). |
ui.card.glass | boolean | false | Enable glass morphism on the auth card. |
ui.card.glassIntensity | 'subtle' | 'medium' | 'strong' | 'medium' | Glass intensity when glass is enabled. |
ui.split.heroPosition | 'left' | 'right' | 'left' | Hero panel position in split layout. |
ui.split.heroImageUrl | string | '' | Hero panel image URL. |
ui.split.headline | string | '' | Hero panel headline text. |
ui.split.subheadline | string | '' | Hero panel subheadline text. |
ui.split.features | array | [] | Feature list shown in the hero panel. |
Runtime Config / Environment Variables
Configure endpoints in nuxt.config.ts under runtimeConfig.public.localAuth. Each key maps to a NUXT_PUBLIC_LOCAL_AUTH_* environment variable.
| Variable | Required | Description |
|---|---|---|
NUXT_PUBLIC_LOCAL_AUTH_BASE_URL | Yes | Backend API base URL. |
NUXT_PUBLIC_LOCAL_AUTH_LOGIN_ENDPOINT | No | Override default /auth/login. |
NUXT_PUBLIC_LOCAL_AUTH_SIGNUP_ENDPOINT | No | Override default /auth/signup. |
NUXT_PUBLIC_LOCAL_AUTH_LOGOUT_ENDPOINT | No | Override default /auth/logout. |
NUXT_PUBLIC_LOCAL_AUTH_REFRESH_ENDPOINT | No | Override default /auth/refresh. |
NUXT_PUBLIC_LOCAL_AUTH_USER_ENDPOINT | No | Override default /auth/me. |
NUXT_PUBLIC_LOCAL_AUTH_FORGOT_PASSWORD_ENDPOINT | No | Override default /auth/forgot-password. |
NUXT_PUBLIC_LOCAL_AUTH_RESET_PASSWORD_ENDPOINT | No | Override default /auth/reset-password. |
NUXT_PUBLIC_LOCAL_AUTH_CHANGE_PASSWORD_ENDPOINT | No | Override default /auth/change-password. |
runtimeConfig.public.localAuth defaults
| Key | Default | Description |
|---|---|---|
baseUrl | "" | Backend API base URL (required). |
loginEndpoint | "/auth/login" | POST endpoint for email/password login. |
signupEndpoint | "/auth/signup" | POST endpoint for registration. |
logoutEndpoint | "/auth/logout" | POST endpoint for logout. |
refreshEndpoint | "/auth/refresh" | POST endpoint for token refresh. |
userEndpoint | "/auth/me" | GET endpoint to fetch the current user. |
forgotPasswordEndpoint | "/auth/forgot-password" | POST endpoint to request a reset email. |
resetPasswordEndpoint | "/auth/reset-password" | POST endpoint to apply a new password. |
changePasswordEndpoint | "/auth/change-password" | POST endpoint for authenticated password change. |
AI Context
package: "@xenterprises/nuxt-x-auth-local"
config-key: xAuth
runtime-config-key: localAuth
use-when: >
Configuring cookie names, redirect paths, feature flags (forgot password,
signup), or UI appearance for nuxt-x-auth-local. Set NUXT_PUBLIC_LOCAL_AUTH_BASE_URL
and optional endpoint overrides via runtimeConfig.public.localAuth to point
the layer at your self-hosted JWT API server.
useXAuth
Self-hosted JWT authentication composable with useState shared state, automatic token refresh on 401, and full auth method coverage.
nuxt-x-auth-stack
Nuxt 4 authentication layer powered by Stack Auth — 10 XAuth-prefixed components, a useXAuth composable with OAuth/magic-link/OTP/password-reset support, global auth middleware, and 8 pre-built pages built on Nuxt UI v4.
