These forums have been archived and are now read-only.
The new forums are live and can be found at https://forums.eveonline.com/
SSO - How do I get the second server request to work with $.ajax()?
var authorization_code = The recovered code from the url$("#ajax").click(function(){ $.ajax('https://login.eveonline.com/oauth/token',{ type: 'post', data: { "grant_type":"authorization_code", "code":authorization_code }, headers: { //NEED TO MAKE THE AUTHORIZATION CODE NOT AVAILABLE TO CLIENT AND USE SERVER "Authorization": 'Basic MzFmYjZkM2QxOWY=:bHV5d0g0YkVlVjA5UTBUSQ==' }, dataType: 'jsonp', success: function (data) { console.info(data); } });});
Request URL:https://login.eveonline.com/oauth/token?callback=jQuery31102722618817699143_1478933693943&grant_type=authorization_code&code=OvasfIF_MyrE2o0&_=1478933693944
http://localhost/pathtomyhomepage.html
Woo! CSM XI!
Fuzzwork Enterprises
Twitter: @fuzzysteve on Twitter
function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange=function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("ajax").innerHTML = "test"; } } xhttp.open("POST", "https://login.eveonline.com/oauth/token?grant_type=authorization_code&code="+authorization_code, true); //NEED TO MAKE THE AUTHORIZATION CODE NOT AVAILABLE TO CLIENT AND USE SERVER xhttp.setRequestHeader("Authorization", "Basic MzFmYjZkNmI0MmVmdkVlVjA5UTBUSQ=="); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send();}