spa-auth-development
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "spa-auth-development":https://skillpi.com/zh/skills/deepskill-1d942f979102a7535ea881a95c4d0c56b187095ae3dcb59be3f09bed0300cbb0。安装前核对上游来源和版本:https://github.com/gdarko/laravel-vue-starter。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
单页应用(SPA)认证开发助手。用于开发基于 Cookie 的 Sanctum 认证流程、Vue Router 路由守卫、认证状态存储、登录/注册/密码重置页面及 CORS/会话配置,覆盖从 CSRF Cookie 到受保护 API 调用的完整认证生命周期。
介绍来源: third_party · gdarko · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
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
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供完整的 SPA 认证开发指南,涵盖 Laravel Sanctum、Vue Router 守卫、CORS 配置等核心内容
- 解决开发者在构建现代 SPA 应用时的实际痛点,实用性强
亮点
- 触发词精准完整,覆盖 SPA 认证流程、Sanctum、Vue Router 守卫等多种场景
- 边界清晰,用户能准确判断是否适用
亮点
- 文档结构清晰,分章节详细描述 Auth Flow、Key Files、CORS Configuration 等
- 包含端到端示例和完整 frontmatter,易于理解和执行
亮点
- 工具来源明确,参数配置正确,覆盖主要异常处理
- 提供了完整的认证生命周期指导,从 CSRF Cookie 到受保护 API 调用
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
文档引用的域名或地址
这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。
- localhost
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。