I am trying to access Eve Online's CREST API. I'm trying to get through authorization via SSO as spelled out here: http://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/authentication.html
I have the authorization code from the initial callback, but the problem arises when sending a post request to get the authorization token. The body of the response is
"error"=>"invalid_client", "error_description"=>"Unknown client"
I'm using Unirest, and I don't think there's anything wrong with my headers. Am I missing something? Is there a silly error here?
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
The auth_head is a Base64 encoded string using the Base64 encode library in Ruby. The Client ID and Key are hard-coded into that Base64 translation, so I'm not sure what the issue could be there either.
It's been awhile since I posted this, but just in case anybody has this specific issue, my problem was that the Base64 encoding contained newline [\n
] characters. After deleting them out of the string, everything worked fine. If you come across a resource that tells you it's ok to include them, I can't speak to that for other API's, but it's certainly NOT ok for this one.