originally posted in:BungieNetPlatform
View Entire Topic
I'm currently trying to figure out manual authentication via the Mac OSX SDK. No matter what I do, the JSON response always returns an error of "WebAuthRequired" and "Please sign-in to continue". I've followed the instructions in the API introduction post but am getting nowhere.
Here is what I have so far:
//<character ID> is replaced with one of my own character IDs.
//the vendor hash for gunsmith is outlined on a separate wiki
NSURL *url = [NSURL URLWithString:@"http://www.bungie.net/platform/Destiny/1/MyAccount/Character/<characterID>/Vendor/570929315<gunsmith>/"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"GET"];
[request setValue:@"www.bungie.net" forHTTPHeaderField:@"Host"];
[request setValue:@"keep-alive" forHTTPHeaderField:@"Connection"];
[request setValue:@"<my api key>" forHTTPHeaderField:@"X-API-Key"];
[request setValue:@"bungledid=<bungledid cookie value>; bungled=<bungled cookie value>" forHTTPHeaderField:@"Cookie"];
//both cookies are obtained by inspecting cookies on a private browsing session
[NSURLConnection connectionWithRequest:request delegate:self];
After retrieving the contents of the request it's always the error message.
Please help!
English
-
To do what you want you need to authenticate with an external provider first (ie. Microsoft Accounts, Google Accounts, Facebook, PSN) and hold on to the cookies which you then use in future requests to identify the account.