[英]How to get a token for a POST request from Postman
The application is in Java.该应用程序使用 Java。 application.yml
应用程序.yml
server:
port: 9000
platform.properties平台属性
jwt.secret="......."
jwt.expiration.time=864000000
jwt.header.prefix=Bearer
jwt.header=my_token
Controller控制器
@PostMapping("/login")
public Result login(@RequestBody LoginRequestDto user){
return userService.login(user);
}
From Postman I'm trying to send a POST request to http://188.130.139.104:9000/login从邮递员我试图发送一个 POST 请求到http://188.130.139.104:9000/login
On the Authorization tab, I select Type: Basic Auth在授权选项卡上,我选择类型:基本身份验证
I fill in the Username and Password fields As a result , I get我填写了用户名和密码字段 结果,我得到
Could not send request
This looks like you're using oauth2 access token.看起来您正在使用 oauth2 访问令牌。 To replicate that on postman you have two options.
要在邮递员上复制它,您有两种选择。 The two options adds Authorization to the header of your request.
这两个选项将 Authorization 添加到您的请求标头。
Option 1:选项1:
On the Authorization tab, scroll to Bearer Token.在授权选项卡上,滚动到承载令牌。 Then put in your token in the 'Token' input field.
然后在“令牌”输入字段中输入您的令牌。
Option 2:选项 2:
You can add it to your headers directly via the Header tab您可以通过“标题”选项卡直接将其添加到标题中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.