diff --git a/README.md b/README.md index ce0133d..81717fd 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,39 @@ npm install ```bash php artisan key:generate ``` +## 🔐 API Authentication with Laravel Passport +Laravel Passport provides a complete OAuth2 authentication system for your Laravel APIs. Below are the steps to install and configure Passport for this Laravel 12 (Dockerized) project. + +### 1. Create a Password Grant Client +```bash +php artisan passport:client --password +``` +### 2. Get an Access Token via API + +Endpoint: +```bash +POST http://:/oauth/token +``` +Headers: +```bash +Accept: application/json +Content-Type: application/x-www-form-urlencoded +``` +Body: +```bash +grant_type=password +client_id=YOUR_CLIENT_ID +client_secret=YOUR_CLIENT_SECRET +username=test@example.com +password=secret123 +scope= +``` +✅ Successful Response + +```json +{ + "token_type": "Bearer", + "access_token": "eyJ0eXAiOiJKV1QiLCJhbGci...", + "expires_in": 3600 +} +```