FEDEX API Oauth 令牌 - 参数丢失或重复。请修改您的请求并重试。 JavaScript

问题描述 投票:0回答:1

标题说明了一切。我正在扰乱 FEDEX API 试图获取我的令牌,但它不允许我这样做。我已经用 python 编写了这个代码,并在邮递员中尝试了它,两种方法都工作正常,我是 JS 新手,无法让它工作。

我收到错误:

[{"code":"BAD.REQUEST.ERROR","message":"Missing or duplicate parameters. Please modify your request and try again."}]

怎么了?我是否可能拼写错误或格式错误?

var input = {
  "grant_type": "client_credentials",
  "client_id": "*****",
  "client_secret": "*****"
}

var data = JSON.stringify(input)

var xhr = new XMLHttpRequest();
xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});


xhr.open("POST", "https://apis-sandbox.fedex.com/oauth/token");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send(data);

})
javascript api request fedex
1个回答
0
投票

你能展示一下Python示例吗?

© www.soinside.com 2019 - 2024. All rights reserved.