Brendan Goodenough
Brendan Goodenough

Reputation: 117

Authentication - Only HTTPS scheme is allowed

Currently working on an app that is connecting to Azure Mobile Services, and needs to require a Microsoft Account to authenticate.

I have been following this guide: http://azure.microsoft.com/en-us/documentation/articles/mobile-services-dotnet-backend-windows-universal-dotnet-get-started-users/ Unforunately I have run into this error: Only https scheme is allowed. and I am not entirely sure on how to fix it.

Screenshot of error: https://i.sstatic.net/hod9i.png

My code is as follows and comes from the guide listed above.

        private async void executiveLoginBtn_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            await AuthenticateAsync();
        }

        // Define a member variable for storing the signed-in user. 
        private MobileServiceUser user;

        // Define a method that performs the authentication process
        // using a Facebook sign-in. 
        private async System.Threading.Tasks.Task AuthenticateAsync()
        {
            while (user == null)
            {
                string message;
                try
                {
                    // Change 'MobileService' to the name of your MobileServiceClient instance.
                    // Sign-in using Facebook authentication.
                    user = await App.MobileService
                        .LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount);
                    message =
                        string.Format("You are now signed in - {0}", user.UserId);
                }
                catch (InvalidOperationException)
                {
                    message = "You must log in. Login Required";
                }

                var dialog = new MessageDialog(message);
                dialog.Commands.Add(new UICommand("OK"));
                await dialog.ShowAsync();
            }
        }

The error also says "WinRT Information: URI Scheme is not https" - so how could I go about making the URI scheme https or otherwise fixing this error when authenticating to Azure Mobile Services?

Upvotes: 2

Views: 3139

Answers (2)

Munchan Park
Munchan Park

Reputation: 61

How I fix the error is as follows:

  1. SSL Enabled to True.

  2. http://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-register-microsoft-authentication/
    Input to Redirect URL

  3. App.xaml.cs

    public static MobileServiceClient MobileService = new MobileServiceClient("http://service.azure-mobile.net/", "---------------------");

    Change to

    public static MobileServiceClient MobileService = new MobileServiceClient("https://service.azure-mobile.net/", "---------------------");

Upvotes: 0

Nick Bauer
Nick Bauer

Reputation: 1072

1) Select the local MobileService project in Solution Explorer.

2) In the Properties window, change SSL Enabled to True.

3) Take note of the SSL URL and use that address to initialize the MobileServiceClient object in your client application.

Upvotes: 1

Related Questions