javascript - 如何在 OAuth 2 之后使用 Basecamp3 API 获取令牌?
问题描述
我正在使用带有身份验证OAuth2的Basecamp3 API构建 Javascript 应用程序。我首先在https://launchpad.37signals.com/integrations注册我的应用程序,以便提供我的并获取我的&来配置我的 OAuth 2 库。redirect_uri
client_id
client_secret
当我启动我的应用程序时,一切似乎都正常。我能够获得 Basecamp 登录信息,并可以访问我的 Basecamp 3 数据。
但是,配置完成后,窗口会关闭,我无法访问我的应用程序。
我检查了日志,我看到了错误 400:
error: 2019-03-27 02:59:55.5955 Error when requesting api key StatusCodeError: 400 - {"timestamp":1553716795279,"status":400,"error":"Bad Request","message":"Bad request","path":"/thirdparty/proxy/oauth2/requestTokens/"}
看起来我无法获得令牌,所以我将实际链接更改https://launchpad.37signals.com/authorization/token
为https://launchpad.37signals.com/authorization/token?type=web_server
像我为授权的第一个链接所做的那样(在此处解释)
但我仍然收到错误,但错误 500:
error: 2019-03-27 02:56:16.5616 Error when requesting api key StatusCodeError: 500 - {"apierror":{"status":"INTERNAL_SERVER_ERROR","timestamp":"27-03-2019 07:56:16","message":"Unexpected error","debugMessage":"could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement","errors":null}}
我什至尝试将协议更改https
为http
. 我仍然收到错误 500:
error: 2019-03-27 03:05:15.515 Error when requesting api key StatusCodeError: 500 - {"timestamp":1553717115170,"status":500,"error":"Internal Server Error","message":"Error requesting from http://launchpad.37signals.com/authorization/token?client_id=1111111111111111111111111&client_secret=22222222222222222222222&code=abcdef&redirect_uri=http%3A%2F%2Flocalhost%2Foauth%2Fredirect&grant_type=authorization_code; got HTTP response HTTP/1.1 307 Temporary Redirect","path":"/thirdparty/proxy/oauth2/requestTokens/"}
我试图以多种方式更改我的请求,但它不起作用。
我尝试使用 Postman 获取令牌(与我尝试使用我的应用程序的方式相同),但我不能。
你知道这个错误来自哪里吗?
解决方案
我找到了解决方案。问题来自我如何curl
在命令行中使用以创建 POST 请求。我将元素放在 url 中,而不是使用--data
选项。
推荐阅读
- python - Pandas 如何在分组后选择前 2 个值?
- reactjs - 如何使用 Framework7-React 在 JS 代码中捕获返回按钮事件?
- c# - 在 WPF 应用程序中实现基窗口类时出现 System.ArgumentNullException
- sql-server - 使用描述更新活动列
- python - 如何在没有 IndexError 的情况下访问特定索引处的 QuerySet 元素?
- swift - 以编程方式在表格视图单元格的中心设置一个按钮
- quarkus - 其他 JDBC 数据库
- java - 为什么 long 2500000000 溢出?
- javascript - 引用和替换包含循环的子模式
- docker - --mount volume 命令被识别为容器的命令行参数