hadyfayed/laravel-agent/auth-setup
Claude Code and agent skill by hadyfayed/laravel-agent
- community
Checking that the SKILL.md file is still in the repository.
SET UP Laravel authentication with Sanctum/Fortify/Breeze, guards, roles & permissions, policies, social login, 2FA; when initializing auth in a new project (NOT for reference questions).
Install
npx vskill@latest install hadyfayed/laravel-agent/auth-setupSKILL.md
The same SKILL.md was published earlier as hadyfayed/laravel-agent/auth-setup.
Environment
- Installed packages: !
composer show laravel/sanctum 2>/dev/null && echo "sanctum=yes" || echo "sanctum=no"; composer show laravel/passport 2>/dev/null && echo "passport=yes" || echo "passport=no"; composer show laravel/fortify 2>/dev/null && echo "fortify=yes" || echo "fortify=no"; composer show spatie/laravel-permission 2>/dev/null && echo "spatie=yes" || echo "spatie=no"; composer show santigarcor/laratrust 2>/dev/null && echo "laratrust=yes" || echo "laratrust=no"
Task
Wire up authentication and authorization. $ARGUMENTS carries the preset (api, spa, oauth, social, web, full) and optional --authz= flag.
Presets
| Preset | Auth type | Packages | |
|---|---|---|---|
api | Token API | laravel/sanctum | |
spa | Cookie/CSRF SPA | laravel/sanctum | |
oauth | OAuth2 server | laravel/passport | |
social | Social login | laravel/socialite (+ socialiteproviders | |
web | Session (Breeze/Fortify) | laravel/breeze or laravel/fortify | |
full | All of the above | per option |
Authorization choices: spatie (roles+permissions, simple), laratrust (teams+roles+permissions, complex), policies (Laravel built-in only).
Steps
- Install missing packages for the chosen preset (use the environment output above to skip what is already present):
``bash composer require laravel/sanctum # api / spa composer require laravel/passport # oauth composer require laravel/breeze # web (then: php artisan breeze:install) composer require spatie/laravel-permission # authz=spatie composer require santigarcor/laratrust # authz=laratrust ``
- Publish vendor config / migrations as each package requires:
``bash php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider" php artisan passport:install # oauth — client keys + personal-access client php artisan laratrust:setup # authz=laratrust — config + migration ``
- Configure `config/auth.php` guards and providers:
web(session) for browser flows.sanctum(orapi) for tokens;passportdriver for OAuth2.- Define the user provider explicitly.
- Add routes under
routes/api.phpand/orroutes/web.php:
POST /login,POST /logout,POST /register.- Sanctum SPA:
GET /sanctum/csrf-cookie, guarded user endpoint. - Social:
GET /auth/{provider}/redirect,GET /auth/{provider}/callback.
- Authorization — follow the conventions in the
laravel-authskill for policies, gates, roles, and permission seeding rather than duplicating them here. Seeders should create roles (e.g.super-admin,admin,user) and attach permissions.
- Optional extras when requested:
- 2FA — enable via Fortify two-factor-challenge configuration.
- Rate limiting — apply
throttleto login/register routes.
- Run migrations and seed authorization data:
``bash php artisan migrate php artisan db:seed --class=RolesAndPermissionsSeeder ``
- Report installed packages, routes added, roles/permissions created, and the
.envkeys still required (e.g. provider API keys for social,PASSPORT_PRIVATE_KEY).
Security guardrails
- Hash passwords via the
hashedcast orHash::make()— never plain. - Regenerate the session after login; revoke tokens on logout.
- Require HTTPS in production; never log credentials or tokens.
Reference
Deep auth patterns — guards, policies, gates, Sanctum/Passport/Socialite integration, 2FA — live in the laravel-auth reference skill. Apply those conventions when implementing the wiring above.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/auth-setup/SKILL.md
Popularity
- Repository stars
- 13
- Repository forks
- 1
- 7-day trend score
- 13
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hadyfayed/laravel-agent/auth-setup)