curl --request POST \
--url https://api.example.com/api/login \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"password": "<string>"
}
'{
"access_token": "<string>",
"token_type": "<string>"
}Authenticate a user and receive an access token
curl --request POST \
--url https://api.example.com/api/login \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"password": "<string>"
}
'{
"access_token": "<string>",
"token_type": "<string>"
}curl -X POST http://localhost:8000/api/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=john@example.com&password=securepassword123"
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "bearer"
}
Show 400 - Incorrect credentials
{
"detail": "Incorrect email or password"
}
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...