小编Fre*_*ckG的帖子

通过 Oauth 请求 Zoom API 的访问令牌 - 错误“缺少授权类型”

我正在尝试通过 Oauth 从 Zoom api 接收访问令牌。无论我尝试以哪种形式发送正文,“Content-Type”:“application/json”或“Content-Type:application/x-www-form-urlencoded”,它总是会出现错误:{reason:“Missing grant type” ,错误:'无效请求'}。

var options = {
  method: "POST",
  url: "https://zoom.us/oauth/token",
  body: JSON.stringify({
    grant_type: "authorization_code",
    code: process.env.AUTH_CODE,
  }),
  redirect_uri: "https://zoom.us",
};

var header = {
  headers: {
    Authorization:
      "Basic " +
      Buffer.from(process.env.ID + ":" + process.env.SECRET).toString("base64"),
  },
  "Content-Type": "application/json",
};

var tokCall = () =>
  axios
    .post("https://zoom.us/oauth/token", options, header)
    .then((response) => {
      console.log(response);
    })
    .catch((error) => {
      console.log(error.response);
    });

tokCall();

Run Code Online (Sandbox Code Playgroud)

我相当确定答案在于 Oauth 接收数据的数据类型,或者它在哪里/是否接收正文。如有任何建议,我们将不胜感激。

json oauth axios zoom-sdk

3
推荐指数
1
解决办法
3236
查看次数

标签 统计

axios ×1

json ×1

oauth ×1

zoom-sdk ×1