Autenticação JWT
JWT: faça login para receber um JWT assinado, chame endpoints protegidos por [Authorize] e por checagem de papel, rotacione refresh tokens e obtenha um token expirado para testes negativos.
Sua conta libera estes endpoints. Use Try it na página de cada endpoint para enviar requisições.
Estes endpoints precisam de uma conta gratuita. Crie uma ou entre para ver os detalhes e testá-los aqui.
- GET
https://api.testingapis.com/api/auth/jwt/adminAllow only JWTs with the admin roleAllow only JWTs with the admin role. - GET
https://api.testingapis.com/api/auth/jwt/expiredReturn a correctly signed JWT that expired an hour agoReturn a correctly signed JWT that expired an hour ago. - POST
https://api.testingapis.com/api/auth/jwt/loginLog in and receive a JWT access token and a refresh tokenLog in and receive a JWT access token and a refresh token. - GET
https://api.testingapis.com/api/auth/jwt/meReturn the claims of the current JWTReturn the claims of the current JWT. - POST
https://api.testingapis.com/api/auth/jwt/refreshExchange a refresh token for new tokensExchange a refresh token for new tokens.
Requisição de exemplo
Allow only JWTs with the admin role. Referência completa e botão Send (em inglês).
cURL
curl -X GET "https://api.testingapis.com/api/auth/jwt/admin" \
-H "Authorization: Bearer {{adminJwt}}"Resposta · 200 OK
{"message": "Welcome, admin. You passed the role check.", "username": "admin"}Entre para ver os detalhes
Os parâmetros, os exemplos de requisição e resposta e o painel Try it ao vivo de estes endpoints são para membros conectados. As contas são gratuitas e levam poucos segundos para criar.