These forums have been archived and are now read-only.
The new forums are live and can be found at https://forums.eveonline.com/
CREST oauth problem
String url = "https://login.eveonline.com/oauth/token"; String charset = "UTF-8"; String grant_type = "authorization_code"; String enc_auth = Base64.encodeToString("9d7dcbb0380f450ea0d2b435b60f4c15:ssEAFgv5PfEs29bluxs9N3milKgC7j6saILCtMPw".getBytes(), Base64.DEFAULT); String query = null; try { query = String.format("grant_type=%s&code=%s", URLEncoder.encode(grant_type, charset), URLEncoder.encode(code[0], charset)); } connection = new URL(url).openConnection(); connection.setDoOutput(true); // Triggers POST. connection.setRequestProperty( "Authorization", enc_auth); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" + charset); try (OutputStream output = connection.getOutputStream()) { output.write(query.getBytes()); }
connection.setRequestProperty( "Authorization", enc_auth);
connection.setRequestProperty( "Authorization", "Basic " + enc_auth);
EsiPy - Python 2.7 / 3.3+ Swagger Client based on pyswagger for ESI
HttpsURLConnection connection = null; try { connection = (HttpsURLConnection) new URL(url).openConnection(); } catch (IOException e) { e.printStackTrace(); } connection.setRequestMethod("POST"); connection.setDoOutput(true); // Triggers POST. connection.setRequestProperty( "Authorization","Basic " + enc_auth); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=" + charset); connection.setRequestProperty("Host", "login.eveonline.com"); try (OutputStream output = connection.getOutputStream()) { output.write(query.getBytes()); } catch (IOException e) { e.printStackTrace(); }
{"error": "invalid_client","error_description": "Unknown client"}
app.get('/crest/', function(req, res) { var sess = req.session; if (sess.auth.state != req.query.state) { //... } else { var loginUrl = URL.parse(CREDENTIALS.login_url); var options = { method : 'POST', host : loginUrl.host, path : O_TOKEN_PATH, headers : { 'Host' : loginUrl.host, 'Authorization' : 'Basic ' + UTIL.btoa(CREDENTIALS.client_id + ':' + CREDENTIALS.client_secret), 'Content-Type': 'application/json' } }; var callback = function(response) { //... }; var request = HTTPS.request(options, callback); var body = { 'grant_type' : 'authorization_code', 'code' : req.query.code }; request.write(JSON.stringify(body)); request.end(); }});
String enc_auth = Base64.encodeToString("9d7dcbb0380f450ea0d2b435b60f4c15:ssEAFgv5PfEs29bluxs9N3milKgC7j6saILCtMPw".getBytes(), Base64.NO_WRAP);