none
Windows Phone 8 app Google sign-in problem RRS feed

  • Question

  • Hello,

    I am trying to implement Google sing-in with Azure app service. For this I configured credentials according https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-how-to-configure-google-authentication/ and putted code in my Windows Phone 8 app :

    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;
    using Windows.UI.Xaml.Navigation;
    using System;
    using Windows.Networking.PushNotifications;
    using Microsoft.WindowsAzure.Messaging;
    using System.Diagnostics;
    using Microsoft.WindowsAzure.MobileServices;
    using Windows.UI.Popups;
    
    namespace MyNotificationHubExample
    {
        public sealed partial class MainPage : Page
        {
            private async System.Threading.Tasks.Task<bool> AuthenticateAsync()
            {
                Debug.WriteLine("MainPage AuthenticateAsync() begin");
                string message;
                bool success = false;
                try
                {
                    user = await App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.Google);
                    message =string.Format("You are now signed in - {0}", user.UserId);
                    Debug.WriteLine("MainPage AuthenticateAsync() "+message);
                    success = true;
                }
                catch (InvalidOperationException ex)
                {
                    message = "You must log in. Login Required";
                    Debug.WriteLine("MainPage AuthenticateAsync() ex = "+ex);
                }
                Debug.WriteLine("MainPage AuthenticateAsync() end");
                var dialog = new MessageDialog(message);
                dialog.Commands.Add(new UICommand("OK"));
                await dialog.ShowAsync();
                return success;
            }
    
            private async void ButtonLogin_Click(object sender, RoutedEventArgs e)
            {
                Debug.WriteLine("MainPage ButtonLogin_Click() begin");
                if (await AuthenticateAsync())
                {
                    Debug.WriteLine("MainPage ButtonLogin_Click() authentication success");
                }
    
            }
        }
    }

    The app behaves in this way:

    1. I click "Sign-in" button and it triggers AuthenticateAsync() , Google login form opens - OK;

    2. I enter my email, password and click OK;

    3. Google login form closes and no "MainPage ButtonLogin_Click() authentication success" console output appears nor operations on Azure services are authenticated however callback link (https://xxx.azurewebsites.net/.auth/login/google/callback) shows "You have successfully signed in".

    Friday, October 28, 2016 2:50 PM

All replies

  • Google has updated their authentication settings to require some additional work on auth.  We are working on updates to the SDKs for this case.  In the interim, you should implement Google Auth via the Google SDK.

    You can find an example in the Azure Mobile book: http://aka.ms/zumobook

    • Proposed as answer by Swikruti Bose Wednesday, November 30, 2016 12:28 PM
    Thursday, November 3, 2016 8:44 PM
    Moderator