@qirolab/nuxt-sanctum-authentication

Nuxt 3 module for easy Laravel Sanctum authentication, offering CSRF token management, both cookie and token-based auth, and SSR compatibility.
22,174 46
Install
npm install @qirolab/nuxt-sanctum-authentication
Latest Version:0.1.15
Vue:3
License:MIT
Last Updated:Apr 19, 2025
Links: GitHub  ·  npm
Maintainer: hkp22

Nuxt Sanctum Authentication

npm version npm downloads License Nuxt

Introduction

The nuxt-sanctum-authentication module seamlessly integrates Laravel Sanctum with Nuxt 3 to provide a simple and secure authentication process for your application. It works efficiently in both Server-Side Rendering (SSR) and Client-Side Rendering (CSR) environments, ensuring consistent and reliable authentication regardless of how your app is rendered.

Key features

  • Seamless CSR and SSR Support: Works smoothly in both client-side and server-side rendering modes.
  • Automatic CSRF Token Management: Automatically handles CSRF tokens to protect your app from cross-site request forgery attacks.
  • Bearer Token Management: Manages Bearer tokens for secure access to protected resources.
  • Integration with Nuxt's ofetch Client: Fully compatible with Nuxt's ofetch client for making authenticated HTTP requests in your application.

Important: Before using this module, make sure that Laravel Sanctum is correctly configured on your backend. For more detailed setup instructions, refer to the Laravel Sanctum documentation.

Documentation

For full documentation, including setup instructions and API reference, visit the Nuxt Sanctum Authentication Documentation.

Video Tutorial

Watch the step-by-step guide on how to use the nuxt-sanctum-authentication module in this Video Tutorial.

Demo Repository

To explore the source code, check out the Nuxt Sanctum Authentication Demo Repository.

  • For Cookie-Based SPA Authentication, see the main branch.
  • For API Token Authentication, check out the api-token-authentication branch.

Contributing

Contributions to the nuxt-sanctum-authentication module are welcome! Whether it's bug fixes, feature enhancements, or documentation improvements, feel free to submit a pull request.

Development Setup

  1. Fork the repository.
  2. Clone your forked repository.
  3. Install dependencies: npm install or yarn install.
  4. Make your changes and commit them with a clear and descriptive message.
  5. Push your changes to your forked repository.
  6. Submit a pull request.

Support my work

If you found this demo helpful and want to support my work, check out some of my other products:


Get $200 free credit for DigitalOcean! (Use this link to sign up)

DigitalOcean Referral
Badge


License

The nuxt-sanctum-authentication module is open-source software licensed under the MIT license.

Related Packages

nuxt-bearer-auth

Reusable Nuxt authentication module for bearer-token APIs with Redis sessions an...

1,593 0
@kaveraa/keycloak-sanctum-vue

Vue 3 client for Keycloak login (SSO) with a Laravel API: Sanctum token, user, r...

809 0
@iankibetsh/sh-core

Core JS layer for sh frameworks: API client, auth (bearer/cookie strategies), pi...

1,203
@authms/vue

AuthMS Vue SDK — createAuthms plugin, useAuthms composable, vAuth directive, and...

826
@idenzy/vue

Vue bindings for Idenzy: a plugin and useSession, useUser and useIdenzy.

163 0

Version History

Version Released License
0.1.15 MIT
0.1.14 MIT
0.1.13 MIT
0.1.12 MIT
0.1.11 MIT