【发布时间】: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 转换中,所以我也不确定可能存在什么问题。
【问题讨论】: