curl --request GET \
--url http://localhost:8000/api/user \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Accept: application/json'
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"email_verified_at": "2024-03-04T10:30:00.000000Z",
"created_at": "2024-03-01T08:15:00.000000Z",
"updated_at": "2024-03-04T10:30:00.000000Z"
}
Retrieve the currently authenticated user profile information
curl --request GET \
--url http://localhost:8000/api/user \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Accept: application/json'
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"email_verified_at": "2024-03-04T10:30:00.000000Z",
"created_at": "2024-03-01T08:15:00.000000Z",
"updated_at": "2024-03-04T10:30:00.000000Z"
}
curl --request GET \
--url http://localhost:8000/api/user \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--header 'Accept: application/json'
{
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"email_verified_at": "2024-03-04T10:30:00.000000Z",
"created_at": "2024-03-01T08:15:00.000000Z",
"updated_at": "2024-03-04T10:30:00.000000Z"
}
auth:sanctum middleware as defined in /home/daytona/workspace/source/Backend/routes/api.php:6.
The response excludes sensitive fields defined in the User model’s $hidden property:
password - User’s hashed passwordremember_token - Laravel’s remember tokenconst { data: user } = useSWR('/api/user', fetcher);