Overview
Nuxt Auth Utils is a minimalist authentication module for Nuxt that provides Vue composables and server utils. It requires server-side rendering (SSR) and is not compatible with nuxt generate.
Features
- Secured & sealed cookies sessions
- OAuth Providers: Auth0, Battle.net, Discord, GitHub, Google, LinkedIn, Microsoft, Spotify, Twitch
- User Session: Vue composables and plugins to fetch the current user session
- Server Utils: Helpers for session management and OAuth event handlers
- Extend Session: Hooks to extend the session data with custom data or log session actions
Installation
To install Nuxt Auth Utils, follow these steps:
- Add the nuxt-auth-utils dependency to your project:
npm install nuxt-auth-utils
- Add nuxt-auth-utils to the modules section of your nuxt.config.ts file:
modules: [
'nuxt-auth-utils',
],
- Set the NUXT_SESSION_PASSWORD environment variable with at least 32 characters in the .env file.
Note: Nuxt Auth Utils can generate a password for you when running Nuxt in development for the first time if NUXT_SESSION_PASSWORD is not set.
- That’s it! You can now add authentication to your Nuxt app.
Summary
Nuxt Auth Utils is a lightweight authentication module for Nuxt that provides Vue composables, server utils, and support for various OAuth providers. It allows for secure sessions, easy retrieval of user session data, and integration with external authentication services. With Nuxt Auth Utils, developers can quickly add authentication functionality to their Nuxt applications.