使用JWT创建PostMan GET请求 [英] Create a PostMan GET Request with JWT

查看:409
本文介绍了使用JWT创建PostMan GET请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是使用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

curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 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.

转到身份验证标签,然后选择承载者令牌:

添加您的令牌:

添加标头 Content-Type:Application/json ,如有必要:

发送您的请求.

如果您计划自动化获取访问令牌并在另一个请求中使用,我建议阅读有关邮递员测试和变量的信息:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆