JWT 認証
JWT。ログインして署名付き JWT を取得し、[Authorize] とロールチェックで保護されたエンドポイントを呼び出し、refresh token をローテーションし、ネガティブテスト用に期限切れのトークンを取得できます。
あなたのアカウントでこれらのエンドポイントが使えます。各エンドポイントのページの Try it でリクエストを送れます。
- 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.
リクエストの例
Allow only JWTs with the admin role. 完全なリファレンスと Send ボタン(英語).
cURL
curl -X GET "https://api.testingapis.com/api/auth/jwt/admin" \
-H "Authorization: Bearer {{adminJwt}}"レスポンス · 200 OK
{"message": "Welcome, admin. You passed the role check.", "username": "admin"}サインインして詳細を見る
これらのエンドポイントのパラメータ、リクエストとレスポンスの例、ライブの Try it パネルは、サインインしたメンバー向けです。アカウントは無料で、数秒で作成できます。