Finish add Passport

master
sundayenglish 4 weeks ago
parent 09237b7e02
commit 9a8557326b
  1. 36
      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://<url_local>:<port>/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
}
```

Loading…
Cancel
Save