【发布时间】:2022-01-26 02:50:58
【问题描述】:
我正在尝试获取 OAuth 令牌以获取对某些 FedEx API 的身份验证访问权限(例如用于跟踪货件的 Track API),但我得到了一个
401 (NOT.AUTHORIZED.ERROR -> "The given client credentials were not valid. Please modify your request and try again") error.
(目前,我正在使用 Postman 来尝试测试 API。)
这是我使用的网址,由 FedEx 提供:
https://apis-sandbox.fedex.com/oauth/token
我已经遵循(据我的理解)应该如何设置正文和标题:
Headers: Content-Type: application/x-www-form-urlencoded
Body: x-www-form-urlencoded (Postman option):
grant_type: client_crendentials
client_id: ***PROJECT_API_KEY
client_secret: ***PROJECT_SECRET KEY
发送后,我只收到上面的错误信息。我检查/双重检查了我的 API 密钥,但我似乎无法让它通过。 有什么想法吗?
postman settings:
POST - URL https://apis-sandbox.fedex.com/oauth/token
Headers - Content-Type: application/x-www-form-urlencoded
Body - x-www-form-urlencoded:
grant_type: client_credentials
client_id: *******
client_secret: *******
(来自https://developer.fedex.com/api/en-us/catalog/authorization/v1/docs.html的信息)
【问题讨论】:
-
欢迎来到 Stack Overflow。请通过tour 了解 Stack Overflow 的工作原理,并阅读How to Ask 以了解如何提高问题的质量。然后edit你的问题包括你的源代码作为工作minimal reproducible example,可以被其他人测试。