Creeaza
Genereaza un token bearer nou de autentificare.
Endpoint
http
POST /api/v1/user/tokensParametri
Parametri body
| Parametru | Tip | Obligatoriu | Descriere |
|---|---|---|---|
name | string | yes | Numele tokenului. |
Exemplu de cerere
sh
curl --location --request POST 'https://files.ro/api/v1/user/tokens' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {token}' \
--data-raw '{
"name": "My Custom App"
}'Răspuns
json
{
"accessToken": {
"id": 1,
"tokenable_type": "App\\Users\\Models\\User",
"tokenable_id": "user_123",
"name": "CLI",
"abilities": [
"*"
],
"last_used_at": "2024-01-01T00:00:00.000000Z",
"expires_at": null,
"created_at": "2024-01-01T00:00:00.000000Z",
"updated_at": "2024-01-01T00:00:00.000000Z"
},
"plainTextToken": "1|plain_text_token"
}json
{
"type": "error",
"message": "You are not authorized"
}json
{
"message": "The given data was invalid.",
"errors": {
"field": [
"The field is required."
]
}
}