使用 JWT 创建 PostMan GET 请求 [英] Create a PostMan GET Request with JWT
问题描述
我是 PostMan 的新手;通常我使用 curl:
I am new using PostMan; normally I use curl:
这个拿JTW
curl -X POST -H "X-Requested-With: XMLHttpRequest" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{ "username": "peris","password": "3nRam0nD3L3s0l1v3s" }' "http://139.152.231.107:1133/canPeris/auth"
另外一个使用之前得到的JTW
and this other one using the JTW obtained before
<代码>卷曲-X GET -H 内容类型:应用/JSON" -H 授权:承载eyJhbGciJIUzUxMiJ9.eyJzdWIiOiJsb3Blei5hbnRvbmlvODVAZ21haWwuY29tIiwiZXhwIjoxNTkwMDQ3NTg4LCJpYXQiOjE1Mh9.3vlQBgfA22ffJZqNic2lVSHiMR6YudlCFoldfwzdk-clz6_XyOvCVTrMihXtYBaJuPI515zTwAnaQBV_h4yquA"http://139.152.231.107:1133/canPeris/api/v1/users/3/menus/vegans"
我正在使用它来生成令牌
I am using this to generate the token
return io.jsonwebtoken.Jwts.builder()
.setClaims(claims)
.setSubject(subject)
.setIssuedAt(createdDate)
.setExpiration(expirationDate)
.signWith(SignatureAlgorithm.HS512, secret)
.compact();
但是在 postMan Signature 方法中我没有找到 HS512
but in the postMan Signature method I haven't found the HS512
推荐答案
我认为这可以解决你的问题.
I think this can solve your problem.
转到Auth选项卡并选择Bearer Token:
添加您的令牌:
添加标题Content-Type: Application/json,如有必要:
发送您的请求.
如果您计划在另一个请求中自动获取和使用访问令牌,我建议您阅读有关邮递员测试和变量的信息:https://medium.com/@codebyjeff/using-postman-environment-variables-auth-tokens-ea9c4fe9d3d7
If you planing automate the access token acquisition and use in another request, I recommend read about postman tests and variables: https://medium.com/@codebyjeff/using-postman-environment-variables-auth-tokens-ea9c4fe9d3d7
这篇关于使用 JWT 创建 PostMan GET 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!