Authenticate a user and receive a JWT. Requires a Cloudflare Turnstile captcha token.
curl --request POST \
--url https://your-api-host/api/Auth \
--header 'Content-Type: application/json' \
--data '{
"UserName": "jdoe",
"Password": "s3cr3t",
"CaptchaToken": "0.ABCdef123..."
}'
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqZG9lIiwibmFtZSI6Impkb2UiLCJleHAiOjE3NDMwMDAwMDB9.SIGNATURE"
}
captchaToken from your Cloudflare Turnstile widget. Requests with a missing or invalid captcha token are rejected with 401 Unauthorized.UserName field on the ASP.NET Identity user record.Authorization: Bearer <token> header on all protected requests. Expires 30 minutes after issue.curl --request POST \
--url https://your-api-host/api/Auth \
--header 'Content-Type: application/json' \
--data '{
"UserName": "jdoe",
"Password": "s3cr3t",
"CaptchaToken": "0.ABCdef123..."
}'
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqZG9lIiwibmFtZSI6Impkb2UiLCJleHAiOjE3NDMwMDAwMDB9.SIGNATURE"
}
401 Unauthorized — with no error body — in all of the following cases:
| Cause | Details |
|---|---|
| User not found | No user record exists for the given UserName. |
| User inactive | The user’s Activo flag is false. |
| Wrong password | Password does not match the stored credential. |
| Captcha failure | CaptchaToken is missing, expired, or invalid. |
401 status with no distinguishing message to avoid leaking information about which users exist in the system.curl --request GET \
--url https://your-api-host/api/Users \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
401 response interceptor in your HTTP client to detect expiry and trigger a re-login automatically rather than handling it in each request handler individually.curl --request POST \
--url https://your-api-host/api/Auth \
--header 'Content-Type: application/json' \
--data '{
"UserName": "jdoe",
"Password": "s3cr3t",
"CaptchaToken": "0.ABCdef123..."
}'
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqZG9lIiwibmFtZSI6Impkb2UiLCJleHAiOjE3NDMwMDAwMDB9.SIGNATURE"
}