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

Allow only tokens with the user role

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

Header: Authorization: Bearer <token>. admin-token and user-token pass; readonly-token gets 403.

Bearer token — user-token

Responses

200
Token has the user role.
401
Token missing or not one of the test tokens.
403
Valid token without the user role.

Example

Request
curl -X GET "https://api.testingapis.com/api/auth/roles/user" \
  -H "Authorization: Bearer user-token" \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response200 OK
{"authorized": true, "user": "Uma User", "roles": ["user"], "scopes": ["read", "write"]}

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.