← スキル一覧に戻る

nuxt-auth
by leeovery
⭐ 1🍴 0📅 2026年1月20日
SKILL.md
name: nuxt-auth description: Authentication with Laravel Sanctum and permission-based authorization. Use when implementing login/logout, protecting pages with permissions, checking permissions in components, or understanding the auth flow.
Nuxt Authentication & Authorization
Laravel Sanctum authentication with permission-based access control.
Core Concepts
auth.md - Complete auth patterns, permissions, page protection
Sanctum Setup
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-auth-sanctum'],
sanctum: {
baseUrl: process.env.NUXT_PUBLIC_API_URL,
endpoints: {
login: '/auth/login',
user: '/auth/user',
csrf: '/sanctum/csrf-cookie',
logout: '/auth/logout',
},
redirect: {
onAuthOnly: '/auth/login',
onGuestOnly: '/',
},
},
})
Auth Composable
const { user, isAuthenticated, login, logout, init } = useSanctumAuth()
// Login
await login({ email, password })
// Logout
await logout()
// Check auth
if (isAuthenticated.value) { /* ... */ }
Permission Checking
const { can, cannot } = usePermissions()
// Single permission
if (can('leads.create')) { /* ... */ }
// In templates
<UButton v-if="can('leads.create')" @click="createLead">Create</UButton>
Page Protection
definePageMeta({
permissions: 'leads.list',
})
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です