javascript - 对跑道应用程序进行应用程序身份验证时收到 400 响应

标签 javascript podio

我正在尝试使用我的跑道应用程序的应用程序身份验证获取访问 token 。

目前,我的代码如下所示:

    const authUrl = 'https://podio.com/oauth/token';
    const data= "grant_type=app&app_id="+appId+"&app_token="+appToken+"&client_id="+clientId+"&redirect_uri="+uri+"&client_secret="+clientSecret;
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("requestResponse").innerHTML = this.responseText;
        }
      };
    xhttp.open("POST",authUrl, true);
    xhttp.send(data);

我不断收到 400 错误,这意味着请求错误。但我已经使用 Beeceptor 对其进行了测试,它工作正常且看起来不错。 我不确定我做错了什么......

最佳答案

终于明白了。添加一行代码...

xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

这完美地修复了它。 在这里找到解决方案:https://help.podio.com/hc/en-us/community/posts/207481648-Cannot-authenticate-by-app-id

关于javascript - 对跑道应用程序进行应用程序身份验证时收到 400 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56833540/

相关文章:

javascript - 使用 cshtml 页面中 SQL 数据库表中的数据更新 html 表

javascript - 使用 html 表单的输入值进行计算的最佳方法是什么?

javascript - 正则表达式 - 如何计算 sql 文本中的单词?

javascript - 如何在React Native中下载文件?

api - Golang 访问原始 Podio 字段值

javascript - 使用符号链接(symbolic link)在多个 React 应用程序之间共享代码

javascript - 如何在浏览器中使用podio-js(没有Node.js)?

python - 使用 python 库获取应用程序的所有项目不起作用

python - 如何编辑已安装的 Python 3 API 中的错误?