manchenkoff / nuxt-auth-sanctum

Nuxt module for Laravel Sanctum authentication
https://manchenkoff.gitbook.io/nuxt-auth-sanctum/
MIT License
173 stars 21 forks source link
laravel laravel-sanctum nuxt nuxt-module nuxt3 nuxt3-module sanctum sanctum-authentication sanctum-spa typescript vue vue3

Nuxt Auth Sanctum

npm version npm downloads License Nuxt

This module provides a simple way to use Laravel Sanctum with Nuxt by leveraging cookies-based authentication. SSR-ready!

Features

Note: Before using this module, please make sure that you have already configured Laravel Sanctum on your backend. You can find more information about Laravel Sanctum here.

Complete documentation - Nuxt Auth Sanctum docs.

Quick Setup

  1. Add nuxt-auth-sanctum dependency to your project
npx nuxi@latest module add nuxt-auth-sanctum
  1. Add any required configuration in your nuxt.config.ts file
export default defineNuxtConfig({
    modules: ['nuxt-auth-sanctum'],

    sanctum: {
        baseUrl: 'http://localhost:80', // Laravel API
    },
});

That's it! You can now use Nuxt Auth Sanctum in your Nuxt app ✨

For more details, check the documentation here.