Authentification JWT
JWT : connectez-vous pour obtenir un JWT signé, appelez des points d’accès protégés par [Authorize] et par un contrôle de rôle, faites tourner les refresh tokens et récupérez un token expiré pour les tests négatifs.
Votre compte débloque ces points d’accès. Utilisez Try it sur la page de chaque point d’accès pour envoyer des requêtes.
Ces points d’accès demandent un compte gratuit. Créez-en un ou connectez-vous pour voir leurs détails et les essayer ici.
- 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.
Exemple de requête
Allow only JWTs with the admin role. Référence complète et bouton Send (en anglais).
curl -X GET "https://api.testingapis.com/api/auth/jwt/admin" \
-H "Authorization: Bearer {{adminJwt}}"{"message": "Welcome, admin. You passed the role check.", "username": "admin"}Connectez-vous pour voir les détails
Les paramètres, les exemples de requête et de réponse et le panneau Try it en direct pour ces points d’accès sont réservés aux membres connectés. Les comptes sont gratuits et se créent en quelques secondes.