TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Allow only JWTs with the admin role

GEThttps://api.testingapis.com/api/auth/jwt/adminSign in to see this endpoint's URL

Log in as admin / admin123. A token for user is authenticated but gets 403.

Bearer token — {{adminJwt}}

Responses

200
Token has the admin role.
401
Token missing, invalid or expired.
403
Valid token without the admin role.

Example

Request
curl -X GET "https://api.testingapis.com/api/auth/jwt/admin" \
  -H "Authorization: Bearer {{adminJwt}}" \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{"message": "Welcome, admin. You passed the role check.", "username": "admin"}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.