I've attempted to rewrite the javascript SDK into an ionic service.
the main change is the execute request function
ExecuteRequest: function (completeUrl, data, authkey, authValue, callback) {
if (callback != null && typeof (callback) != "function")
throw "Callback must be null of a function";
if (data == null)
data = {};
var startTime = new Date();
//var requestBody = JSON.stringify(data);
var requestBody = data;
var requestheaders = {
'Content-Type': 'application/x-www-form-urlencoded',
//; charset=UTF-8',
//'Content-Type': 'application/json',
'X-PlayFabSDK': 'JavaScriptSDK-' + PlayFab._internalSettings.sdkVersion
}
if (authkey != null)
requestheaders[authkey] = authValue;
console.log("executerequest headers" + JSON.stringify(requestheaders));
$http.post( completeUrl,
requestBody,
requestheaders )
.success(function(result){
// result.CallBackTimeMS = new Date() - startTime;
callback(result, null);
so I can login ok
04-22 00:15:31.919: I/chromium(950): [INFO:CONSOLE(54)] "result [{"code":200,"status":"OK","data":{"SessionTicket":"2CF133EE2E9F7CD1---65D6-8D369EF9089CB85-52C1A4A3F6FEDF73.AF12251C63647E82","PlayFabId":"2CF133EE2E9F7CD1","NewlyCreated":false,"SettingsForUser":{"NeedsAttribution":false},"LastLoginTime":"2016-04-21T13:59:34.916Z"}}]", source: file:///android_asset/www/scripts/login/login.service.js (54)
but trying to use the sesssion ticket doesnt work for me
04-22 00:15:32.389: I/chromium(950): [INFO:CONSOLE(63)] "executerequest headers{"Content-Type":"application/x-www-form-urlencoded","X-PlayFabSDK":"JavaScriptSDK-0.13.160328","X-Authentication":"2CF133EE2E9F7CD1---65D6-8D369EF9089CB85-52C1A4A3F6FEDF73.AF12251C63647E82"}", source: file:///android_asset/www/scripts/playfab/playfab.service.js (63)
04-22 00:15:32.679: I/chromium(950): [INFO:CONSOLE(64)] "androidpushregisterCallback err{"code":401,"status":"Unauthorized","error":"NotAuthenticated","errorCode":1074,"errorMessage":"Missing or invalid X-Authentication HTTP header"}", source: file:///android_asset/www/scripts/realpush/realpush.service.js (64)
04-22 00:15:32.679: I/chromium(950): [INFO:CONSOLE(64)] "androidpushregisterCallback err{"code":503,"status":"Service Unavailable","error":"Connection error","errorCode":2,"errorMessage":{"data":{"code":401,"status":"Unauthorized","error":"NotAuthenticated","errorCode":1074,"errorMessage":"Missing or invalid X-Authentication HTTP header"},"status":401,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"Content-Type":"application/x-www-form-urlencoded","X-PlayFabSDK":"JavaScriptSDK-0.13.160328","X-Authentication":"2CF133EE2E9F7CD1---65D6-8D369EF9089CB85-52C1A4A3F6FEDF73.AF12251C63647E82","url":"https://65D6.playfabapi.com/Client/AndroidDevicePushNotificationRegistration","data":{"DeviceToken":"APA91bFXbk2NfyFd2KNYYKIph72H8PszM_dHCvJx4YnnZJuQqG1ttELtFecBoZ5ItJ6SeAWQg-OyzyR3fr6M5KmE5uO6ZD1ey_14AkujRvgt3XOoAv6mRtHNwsYMmtnoCG__QdcJkb2Q","SendPushNotificationConfirmation":true,"ConfirmationMessege":"Welcome to PlayFab!"},"headers":{"Accept":"application/json, text/plain, */*","Content-Type":"application/json;charset=utf-8"}},"statusText":"Unauthorized"}}", source: file:///android_asset/www/scripts/realpush/realpush.service.js (64)
any comment appreciated !
thanks