feat: add nuxt-auth-sanctum for Laravel Sanctum authentication

This commit is contained in:
2025-10-21 13:09:38 +02:00
parent 47a4d320cb
commit 01fa0bacdc
4 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
<template>
<div></div>
</template>

View File

@@ -10,7 +10,8 @@ export default defineNuxtConfig({
// externé moduly
modules: [
'@nuxt/image', // na obrázky
'vuetify-nuxt-module' // Vuetify
'vuetify-nuxt-module', // Vuetify
'nuxt-auth-sanctum' // Laravel Sanctum auth
],
nitro: {
@@ -19,4 +20,17 @@ export default defineNuxtConfig({
routes: ["/", "/info/student", "/info/company", "/register", "/about"],
},
},
sanctum: {
baseUrl: 'http://localhost:8000',
origin: 'http://localhost:3000',
redirect: {
onLogin: '/dashboard',
onLogout: "/",
onAuthOnly: '/login',
keepRequestedRoute: false,
onGuestOnly: false,
},
redirectIfAuthenticated: true
},
});

View File

@@ -9,6 +9,7 @@
"dependencies": {
"@nuxt/image": "^1.11.0",
"nuxt": "^4.1.3",
"nuxt-auth-sanctum": "^1.4.1",
"vue": "^3.5.22",
"vue-router": "^4.5.1",
"vuetify-nuxt-module": "^0.18.8"
@@ -7645,6 +7646,17 @@
}
}
},
"node_modules/nuxt-auth-sanctum": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/nuxt-auth-sanctum/-/nuxt-auth-sanctum-1.4.1.tgz",
"integrity": "sha512-QKD39eSRVsqdhGMv1BGmZ+zG3Vn2Xy1C73lf7X/Hd3EuKgne8WPPv5ZwrvVU6SwbxtYnqA1xUC97oRFoTLsAcQ==",
"license": "MIT",
"dependencies": {
"defu": "^6.1.4",
"ofetch": "^1.4.1",
"pathe": "^2.0.3"
}
},
"node_modules/nypm": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/nypm/-/nypm-0.6.2.tgz",

View File

@@ -12,6 +12,7 @@
"dependencies": {
"@nuxt/image": "^1.11.0",
"nuxt": "^4.1.3",
"nuxt-auth-sanctum": "^1.4.1",
"vue": "^3.5.22",
"vue-router": "^4.5.1",
"vuetify-nuxt-module": "^0.18.8"