spa-auth-development

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.

Last repository push
GitHub Stars
147
Forks
61
Issues / PRs
5

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.

0 Downloads

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

Browse files at the source ↗

Original SKILL.md

Open original ↗
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: project

SPA 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

  1. Vue app calls GET /sanctum/csrf-cookie to get XSRF token
  2. User submits login form → POST /login (Fortify handles this)
  3. Laravel returns session cookie + user data
  4. All subsequent API calls include the session cookie automatically (withCredentials: true)
  5. Protected routes use auth:sanctum middleware

Key Files

Backend

  • config/sanctum.php — Stateful domains, guards, CSRF middleware
  • config/cors.php — CORS paths (api/*, login, logout, register, etc.) with supports_credentials: true
  • config/fortify.php — Auth features (registration, password reset, email verification)
  • app/Providers/FortifyServiceProvider.php — Binds Fortify actions and custom LoginResponse
  • app/Http/Responses/LoginResponse.php — Returns JSON with user data for SPA
  • app/Http/Middleware/ApplyLocale.php — Sets locale from X-Locale header
  • bootstrap/app.php — statefulApi() middleware, apply_locale alias

Frontend

  • stores/auth.js — Pinia store with login, register, logout, getCurrentUser
  • services/AuthService.ts — API calls for auth endpoints (login, register, forgot/reset password, etc.)
  • router/index.js — Navigation guards checking requiresAuth and requiresAbility route meta
  • plugins/axios.js — Axios configured with withCredentials, X-Locale header, base URL from window.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 authenticated
  • requiresAbility: 'ability_name' — Checks user abilities via Bouncer
  • isPublicAuthPage: true — Redirects to dashboard if already authenticated
  • isOwner: 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

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供完整的 SPA 认证开发指南,涵盖 Laravel Sanctum、Vue Router 守卫、CORS 配置等核心内容
  • 解决开发者在构建现代 SPA 应用时的实际痛点,实用性强
Trigger Precision95/100

Highlights

  • 触发词精准完整,覆盖 SPA 认证流程、Sanctum、Vue Router 守卫等多种场景
  • 边界清晰,用户能准确判断是否适用
Structure and Standards95/100

Highlights

  • 文档结构清晰,分章节详细描述 Auth Flow、Key Files、CORS Configuration 等
  • 包含端到端示例和完整 frontmatter,易于理解和执行
Execution Reliability90/100

Highlights

  • 工具来源明确,参数配置正确,覆盖主要异常处理
  • 提供了完整的认证生命周期指导,从 CSRF Cookie 到受保护 API 调用
Evidence Verifiability (mean of the first four)91/100

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

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

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.