This repo demonstrates how to build a headless Laravel backend using Fortify and Sanctum, ideal for use with React, Vue, or mobile frontends.
- Laravel 11
- Laravel Fortify
- Laravel Sanctum
- Stateless API with Token-based auth
- SQLite (for local testing)
- ✅ API registration & login
- ✅ Sanctum token-based authentication
- ✅ Auth-protected
/userendpoint - ✅ Password reset endpoints (optional)
- ✅ Ready for React/Vue frontend consumption
git clone https://github.com/dipankar77/laravel-auth-fortify-api.git
cd laravel-auth-fortify-api
2. Install
composer install
cp .env.example .env
touch database/database.sqlite
php artisan migrate
3. Run Locally
php artisan serve
📬 Test with API Client (Postman or cURL)
Login:
POST /login
{
"email": "test@example.com",
"password": "password"
}
Get Authenticated User:
GET /api/user
Authorization: Bearer {token}
🔒 API Security Notes
• Sanctum is used for SPA/token-based auth
• CSRF/token protection is configured for API context
• Extensible for JWT-based or OAuth if needed
🧱 Next Step
You can now connect this API backend to a React or Vue frontend for complete decoupled authentication.
📄 License
MIT — Use, adapt, and share freely.
Part of my professional Laravel portfolio. Full collection: github.com/dipankar77
---
## ✅ Update Profile README
Under:
```md
### 1. 🔧 Laravel Backend Projects
| [laravel-auth-fortify-api](https://github.com/dipankar77/laravel-auth-fortify-api) | Headless API auth using Laravel Fortify + Sanctum, ideal for SPAs or mobile |