Answered by:
Google/Facebook login not working with Windows Phone 8.1

Question
-
I have a Azure Mobile Services backend which supports Google and Facebook authentication for my mobile app. This works without problems for my Windows 8.1 and also for a new Windows Phone Silverlight 8.1 app.
When I try the same login code with a new Windows Phone 8.1 app, the LoginAsync() method never returns and a login is not possible.
Is this a known issue? I'm using the Mobile Services v.1.2.1 library for all three clients.
The simple login code looks like this:
private async void Login_OnClick(object sender, RoutedEventArgs e) { try { var mobileService = new MobileServiceClient("https://xxx.azure-mobile.net/", "xxx"); var user = await mobileService.LoginAsync(MobileServiceAuthenticationProvider.Facebook); loggedInStatus.Text = "Logged in! " + user.UserId; } catch (Exception) { loggedInStatus.Text = "not logged in!"; } }
Any help appreciated. :)
Best regards
StefanMonday, April 7, 2014 1:01 PM
Answers
-
Hi Stefan,
For Windows Phone 8.1 devices there is a new step in the login process you need to do. In your app.xaml.cs, OnActivated add the following if block:
if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation) { App.MobileService.LoginComplete(args as WebAuthenticationBrokerContinuationEventArgs); }
Where MobileService is your MobileServiceClient reference. We'll work on getting a blog post and documentation up on this new step soon.
- Proposed as answer by Phillip Van Nortwick Monday, April 7, 2014 7:36 PM
- Marked as answer by Stefan Zueger Thursday, April 10, 2014 6:03 AM
Monday, April 7, 2014 7:36 PM
All replies
-
Hi Stefan,
For Windows Phone 8.1 devices there is a new step in the login process you need to do. In your app.xaml.cs, OnActivated add the following if block:
if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation) { App.MobileService.LoginComplete(args as WebAuthenticationBrokerContinuationEventArgs); }
Where MobileService is your MobileServiceClient reference. We'll work on getting a blog post and documentation up on this new step soon.
- Proposed as answer by Phillip Van Nortwick Monday, April 7, 2014 7:36 PM
- Marked as answer by Stefan Zueger Thursday, April 10, 2014 6:03 AM
Monday, April 7, 2014 7:36 PM -
Hi Phillip
Many thanks for your fast reply. I don't really understand, why this difference only exists for Phone 8.1 apps, but as long as it's working, it's fine for me. :)
Regards
StefanThursday, April 10, 2014 6:06 AM -
I had a similar problema, that was the solution, this really need to be in a more public document.Wednesday, March 4, 2015 7:50 PM