More Premium Hugo Themes Premium Vue Themes

Nuxt Auth Sanctum

Nuxt module for Laravel Sanctum authentication

Nuxt Auth Sanctum

Nuxt module for Laravel Sanctum authentication

Author Avatar Theme by manchenkoff
Github Stars Github Stars: 219
Last Commit Last Commit: May 12, 2025 -
First Commit Created: Jan 15, 2024 -
default image

Overview:

Nuxt Auth Sanctum is a module that provides a simple way to use Laravel Sanctum with Nuxt. It leverages cookies-based authentication and is SSR-ready. Before using this module, make sure you have already configured Laravel Sanctum on your backend.

Features:

  • useSanctumAuth composable for easy access to the current user and authentication methods
  • Automated CSRF token header and cookie management
  • Support for both CSR and SSR modes
  • Pre-configured middleware for pages that require authentication
  • Ability to cast current user information to any class
  • Compatible with the default Nuxt ofetch client
  • TypeScript support

Installation:

To install Nuxt Auth Sanctum, follow these steps:

  1. Add the nuxt-auth-sanctum dependency to your project.
npm install nuxt-auth-sanctum
  1. Add 'nuxt-auth-sanctum' to the modules section of your nuxt.config.ts file.
export default {
    //...
    modules: [
        'nuxt-auth-sanctum',
    ],
    //...
}

Summary:

Nuxt Auth Sanctum is a powerful module that allows you to easily integrate Laravel Sanctum authentication into your Nuxt app. With features such as automated CSRF token management and SSR support, it provides a seamless and secure authentication solution. By following a simple installation process, you can start using Nuxt Auth Sanctum in your project and take advantage of its convenient composables and middleware.