spa-auth-development
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "spa-auth-development" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-1d942f979102a7535ea881a95c4d0c56b187095ae3dcb59be3f09bed0300cbb0. Verify the upstream source and version against https://github.com/gdarko/laravel-vue-starter before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
SPA authentication development helper. Used for developing Cookie-based Sanctum authentication flows, Vue Router route guards, auth state storage, login/register/password-reset pages, and CORS/session configuration, covering the full authentication lifecycle from CSRF cookie to protected API calls.
Introduction source: third_party · gdarko · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Activate when working on SPA authentication flow, Sanctum cookie-based auth, Vue Router guards, auth store, login/register/password reset pages, or CORS/session configuration. Covers the full auth lifecycle from CSRF cookie to protected API calls.
- Testing
- Not tested
Browse files
Frontmatter
name: spa-auth-development
description: "Activate when working on SPA authentication flow, Sanctum cookie-based auth, Vue Router guards, auth store, login/register/password reset pages, or CORS/session configuration. Covers the full auth lifecycle from CSRF cookie to protected API calls."
license: MIT
metadata:
author: projectSPA Authentication Development
This project uses a decoupled SPA architecture where Vue handles all routing and Laravel serves as a JSON API with Sanctum cookie-based authentication.
Auth Flow
- Vue app calls
GET /sanctum/csrf-cookieto get XSRF token - User submits login form →
POST /login(Fortify handles this) - Laravel returns session cookie + user data
- All subsequent API calls include the session cookie automatically (
withCredentials: true) - Protected routes use
auth:sanctummiddleware
Key Files
Backend
config/sanctum.php— Stateful domains, guards, CSRF middlewareconfig/cors.php— CORS paths (api/*, login, logout, register, etc.) withsupports_credentials: trueconfig/fortify.php— Auth features (registration, password reset, email verification)app/Providers/FortifyServiceProvider.php— Binds Fortify actions and custom LoginResponseapp/Http/Responses/LoginResponse.php— Returns JSON with user data for SPAapp/Http/Middleware/ApplyLocale.php— Sets locale from X-Locale headerbootstrap/app.php—statefulApi()middleware,apply_localealias
Frontend
stores/auth.js— Pinia store with login, register, logout, getCurrentUserservices/AuthService.ts— API calls for auth endpoints (login, register, forgot/reset password, etc.)router/index.js— Navigation guards checkingrequiresAuthandrequiresAbilityroute metaplugins/axios.js— Axios configured withwithCredentials, X-Locale header, base URL fromwindow.AppConfig
CORS Configuration
For the SPA to work, these .env values must match:
APP_URL=http://localhost:8000
SANCTUM_STATEFUL_DOMAINS=localhost:8000
SESSION_DOMAIN=localhost
Route Guards
Routes use meta fields for auth:
requiresAuth: true— Redirects to login if not authenticatedrequiresAbility: 'ability_name'— Checks user abilities via BouncerisPublicAuthPage: true— Redirects to dashboard if already authenticatedisOwner: true— Owner-only routes
Authorization
Uses Silber Bouncer with abilities:
- Abilities defined in
resources/app/stub/abilities.js(CREATE_USER, EDIT_USER, etc.) - Checked in Vue Router guards and sidebar menu visibility
- Backend uses
Gate::authorize()in controllers - Roles seeded in
database/seeders/BouncerSeeder.php
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 SPA 认证开发指南,涵盖 Laravel Sanctum、Vue Router 守卫、CORS 配置等核心内容
- 解决开发者在构建现代 SPA 应用时的实际痛点,实用性强
Highlights
- 触发词精准完整,覆盖 SPA 认证流程、Sanctum、Vue Router 守卫等多种场景
- 边界清晰,用户能准确判断是否适用
Highlights
- 文档结构清晰,分章节详细描述 Auth Flow、Key Files、CORS Configuration 等
- 包含端到端示例和完整 frontmatter,易于理解和执行
Highlights
- 工具来源明确,参数配置正确,覆盖主要异常处理
- 提供了完整的认证生命周期指导,从 CSRF Cookie 到受保护 API 调用
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- localhost
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.