【问题标题】:Unknown client accessing Eve API未知客户端访问 Eve API
【发布时间】:2017-02-08 10:18:19
【问题描述】:

我正在尝试访问 Eve Online 的 CREST API。我正在尝试通过 SSO 获得授权,如此处所述: http://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/authentication.html

我有来自初始回调的授权代码,但是在发送发布请求以获取授权令牌时出现问题。响应的正文是

"error"=>"invalid_client", "error_description"=>"Unknown client"

我正在使用 Unirest,我认为我的标题没有任何问题。我错过了什么吗?这里有愚蠢的错误吗?

 headers = { "Authorization" => "Basic #{auth_head}",
          "Content-Type" =>  "application/json",
          "Accept" => "application/json",
          "Host" => "login.eveonline.com"
  }

 params = { "grant_type" => "authorization_code",
         "code" => "#{auth_code}"
}

response = Unirest.post "https://login.eveonline.com/oauth/token", 
                    headers:headers, 
                    parameters:params.to_json

auth_head 是使用 Ruby 中的 Base64 编码库的 Base64 编码字符串。客户端 ID 和密钥被硬编码到 Base64 转换中,所以我也不确定可能存在什么问题。

【问题讨论】:

    标签: ruby rest oauth unirest


    【解决方案1】:

    自从我发布此内容以来已经有一段时间了,但以防万一有人遇到这个特定问题,我的问题是 Base64 编码包含换行符 [\n] 字符。从字符串中删除它们后,一切正常。如果您遇到的资源告诉您可以包含它们,我无法为其他 API 说话,但对于这个肯定不行。

    【讨论】:

      猜你喜欢
      • 2021-10-28
      • 1970-01-01
      • 1970-01-01
      • 2018-08-31
      • 1970-01-01
      • 2014-01-28
      • 2017-10-10
      • 2022-10-31
      • 2019-07-25
      相关资源
      最近更新 更多