[英]Calling an API which needs a Bearer Access Token
I am trying to call an API which I have been instructed:我正在尝试调用我被指示的 API:
This is expecting an Authorization header: Bearer Access Token.
这需要一个 Authorization 标头:Bearer Access Token。
I have the Bearer Access Token, and have tried via Postman, and via C# using WebRequest, to no avail.我有不记名访问令牌,并通过 Postman 和 C# 使用 WebRequest 进行了尝试,但无济于事。
Within Postman I have the method set as GET, Authorization set as No Auth, on the Headers tab I have tried adding one header like so:在 Postman 中,我将方法设置为 GET,授权设置为 No Auth,在 Headers 选项卡上,我尝试添加一个标题,如下所示:
Header: "Authorization"标题:“授权”
Value: "mytoken"值:“我的令牌”
I have also tried我也试过
Header: "Bearer"标题:“承载”
Value: "mytoken"值:“我的令牌”
Also还
Header: "Authorization"标题:“授权”
Value: "Bearer mytoken"值:“承载mytoken”
I think maybe it does not work in Postman because of some other headers sent from within PM, but surely from a test C# console application this should work?我想也许它在 Postman 中不起作用,因为从 PM 内部发送了一些其他标头,但肯定从测试 C# 控制台应用程序这应该工作?
What is the right way to give an API the bearer access token?为 API 提供不记名访问令牌的正确方法是什么? Is the token meant to be encoded?
令牌是要编码的吗?
Try to add this line in your header on Postman:尝试在 Postman 的标题中添加此行:
Authorization: Bearer <token>
It should work...它应该工作...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.