-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
📦 Sub-Issue of Epic #208
Part of: #208 (httpOnly Cookie Authentication Migration)
Priority: High
Area: Backend, Authentication, Security
Repository: api
Goal
Configure Laravel Sanctum for SPA authentication mode and set up CORS to allow credential-based requests from the frontend domain.
Acceptance Criteria
-
config/sanctum.phpconfigured withSANCTUM_STATEFUL_DOMAINS -
.env.exampleupdated with required Sanctum variables -
config/cors.phpallows credentials (supports_credentials: true) - CORS configuration allows frontend domain (localhost:5173 for dev, secpal.app for prod)
- API routes use
auth:sanctummiddleware - Tests verify Sanctum middleware works
- PHPStan passes
- Pint passes
- All existing tests pass
Implementation Details
Files to modify:
config/sanctum.phpconfig/cors.php.env.exampleroutes/api.php(verify middleware)
Environment variables:
SANCTUM_STATEFUL_DOMAINS=localhost:5173,secpal.app,www.secpal.app
SESSION_DOMAIN=localhost
SESSION_SECURE_COOKIE=false # true in productionCORS Configuration:
// config/cors.php
'supports_credentials' => true,
'allowed_origins' => [
'http://localhost:5173',
'https://secpal.app',
'https://www.secpal.app',
],Dependencies
- Blocks: Frontend PR-1 (Frontend needs backend configured first)
- Depends on: None (first step)
Testing
ddev exec php artisan test --filter=Auth
ddev exec vendor/bin/phpstan analyze
ddev exec vendor/bin/pint --test --dirtyReferences
Metadata
Metadata
Assignees
Type
Projects
Status
✅ Done