Azure Mobile Services authentication not working with Windows Phone 8.1 Universal app -
Azure Mobile Services authentication not working with Windows Phone 8.1 Universal app -
i'm adding azure mobile services authentication universal windows project. it's set , working on server , in windows store version of app, can't work windows phone 8.1 version of app. have 2 different apps i've been working on same problem, created test app based strictly on steps outlined in this article. sample app has 1 button on ui effort authenticate user twitter when pressed.
the flow seeing ui is:
press button screen goes black moment screen displays "resuming..." spinner invalidoperationexception gets caughtthe exception details:
system.invalidoperationexception caught hresult=-2146233079 message=authentication cancelled user. source=mscorlib
stacktrace: @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.taskawaiter`1.getresult() @ microsoft.windowsazure.mobileservices.mobileserviceauthentication.<loginasync>d__0.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ system.runtime.compilerservices.taskawaiter`1.getresult() @ mobileauthtest.mainpage.<authenticateasync>d__3.movenext() innerexception: the code using copied verbatim article, i'll paste here too:
private async void button_click(object sender, routedeventargs e) { await this.authenticateasync(); } // define method performs authentication process // using twitter sign-in. private async task authenticateasync() { while (user == null) { string message; seek { // alter 'mobileservice' name of mobileserviceclient instance. // sign-in using twitter authentication. user = await app.mobileservice .loginasync(mobileserviceauthenticationprovider.twitter); message = string.format("you signed in - {0}", user.userid); } grab (invalidoperationexception) { message = "you must log in. login required"; } var dialog = new messagedialog(message); dialog.commands.add(new uicommand("ok")); await dialog.showasync(); } } and override in app.xaml.cs:
protected override void onactivated(iactivatedeventargs args) { // windows phone 8.1 requires handle respose webauthenticationbroker. #if windows_phone_app if (args.kind == activationkind.webauthenticationbrokercontinuation) { // completes sign-in process started loginasync. // alter 'mobileservice' name of mobileserviceclient instance. mobileservice.logincomplete(args webauthenticationbrokercontinuationeventargs); } #endif base.onactivated(args); } my testing on real windows phone 8.1 device (nokia 920 8.1 update).
it's worth pointing out project i'm trying work in using xamarin.forms android, ios , windows phone (i wanted comparing between xamarin.forms windows phone , universal apps windows phone). of apps work, except 2 windows phone apps. xamarin.forms windows phone app windows phone silverlight 8.1 app acts same described above universal wp, fails error, "authentication failed http response code 0."
i've searched around , haven't found other cases of people encountering same issue am. there need simple nobody feels need in writing?
well, turns out issue seeing may device. sent sample app dev testing , had no issues. able log in both sample app , real app on simulator. isn't thorough test sample, it's plenty me stop banging head on desk.
windows-phone-8.1 azure-mobile-services win-universal-app
Comments
Post a Comment