originally posted in:BungieNetPlatform
View Entire Topic
I know this isn't the first time this question has been asked but I have been banging my head against my keyboard for the past 2 days and would really appreciate some help.
I'm trying to build a simple application but i'm stuck on the authentication process. I've managed to get the bungled, bungledid and bungledatk cookies but all requests I have send return the exact same error.
[spoiler]{"ErrorCode":99,"ThrottleSeconds":0,"ErrorStatus":"WebAuthRequired","Message":"Please sign-in to continue.","MessageData":{}}[/spoiler]
This is the code I have been using to send my request:
[spoiler]
function CreateRequest (cookies, url, method, authenticate, message){
if(typeof message !== "string") message = null;
var dfrrd = $.Deferred (),
xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.timeout = 5000;
xhr.onreadystatechange = function(){
if(xhr.readyState === 4)
if (xhr.status === 200)
dfrrd.resolve(xhr.responseText);
else dfrrd.reject({Reason: "Network error: " + xhr.status });
};
if(authenticate){
console.log ('I am being authenticated') ;
xhr.withCredentials = true;
xhr.setRequestHeader("x-csrf", cookies[2].value);
}
if(message !== null) xhr.send(message);
else xhr.send();
return dfrrd.promise () ;
};
[/spoiler]
and these are the values I've been feeding the function:
[spoiler](cookies, 'https://www.bungie.net/Platform/User/GetBungieNetUser/', 'GET', true)[/spoiler]
In theory it should work.
Maybe I have been staring at my screen for too long and just fail to see the mistake....
Edit:
I work with Node-Webkit
English
-
You could use my API tester for this: http://www.rickdeman.nl/Destiny/apitest.php It does not log anything, you can find the source here: http://pastebin.com/RJc3jtDw