Save the JWT as a variable
创建一个 global variable.
先在Postman你的登录API中,打开 test Tab。
输入下面的代码
const response = pm.response.json();
pm.globals.set("jwt_token", response.access_token);
使用 Global variable
在 REST API 的 Authentication tab 中,使用变量。
{{jwt_token}}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/8720589f242c8f9245f5d22909f54a35.png)
使用
先 Send 一次 Login API,然后再访问其他 REST API 即可。
参考资料
using-jwt-to-authenticate-and-authorize-requests-in-postman