【问题标题】:How to get a token with Basecamp3 API after OAuth 2?如何在 OAuth 2 之后使用 Basecamp3 API 获取令牌?
【发布时间】:2019-04-02 04:09:53
【问题描述】:

我正在使用Basecamp3 API 和身份验证OAuth2 构建一个Javascript 应用程序。我首先在https://launchpad.37signals.com/integrations 注册我的应用程序,以便提供我的redirect_uri 并让我的client_idclient_secret 配置我的OAuth 2 库。

当我启动我的应用程序时,似乎一切正常。我可以获得 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,就像我为授权的第一个链接所做的那样(解释为 here

但我仍然收到错误,但错误 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 获取令牌(与我尝试使用我的应用的方式相同),但我不能。

你知道这个错误是从哪里来的吗?

【问题讨论】:

    标签: javascript api oauth-2.0 basecamp


    【解决方案1】:

    我找到了解决办法。问题来自我如何在命令行中使用curl 来创建 POST 请求。我将元素放在 url 中,而不是使用 --data 选项。

    【讨论】:

      猜你喜欢
      • 2013-09-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-12
      • 1970-01-01
      • 1970-01-01
      • 2018-05-07
      相关资源
      最近更新 更多