Registering Azure App Service application to use Microsoft Account Login

I am working through the Xamarin.Forms samples and I am roadblocked on the implementation of Authentication against an Azure App Service.

I have been able to get the Azure App Service spun up, and have it locked down where a MS account is needed to login. I have tested this via a web browser hitting the app login url to validate that the authentication is working properly and I can use the token passed back to interact with the Azure App Api. All is good there. (I followed the MS documentation for this)

I have followed the steps to configure the MS login. I admit I am a little dubious in my use of a custom URL scheme and a callback that is properly formatted for the mobile client. Not clear on the context of that. The documentation for Azure is all over the place and not concise in what is the recommended pattern for Xamarin auth with Azure App service.

When I run the TodoAzureAuth iOS sample, I get the login, but the web client used to log in doesn't return to the mobile app; it doesn't return at all and just sits in an eternal await. (It's line 32 of the AppDelegage.cs in the iOS project). Is this a fault of the sample?

I suspect its something to do with the MobileServiceClient but I don't trust any current documentation.

Is there a sample somewhere that works properly? Any recommendations for what documentation I can trust that is mostly up to date? (A lot of the search results on this forum are years old.)

This has been holding me up for about a week now and it's pretty frustrating. It's just authentication. I can code this for a web app in half a day or less.

Details:
VS 2017 pairs with a Mac
Platform with issue: iOS 12.1
iPhone Simulator
Xamarin Forms 3.5

Sample referenced: github.com/xamarin/xamarin-forms-samples/tree/master/WebServices/TodoAzureAuth

Thanks ahead of time for any suggestions.

Answers

  • PaulNTUPaulNTU USMember ✭✭✭

    Hello,

    You probably have already seen this link but I will post it just in case its of any use to you.

    https://docs.microsoft.com/en-gb/xamarin/xamarin-forms/data-cloud/authentication/azure

    I originally got caught out by the HTTPS changes so you may want to double check this. Notice the part in the link about Https and IOS 9. For apple (and also android going forwards) mobile apps will not allow unsecured connections by default. You have to use a https connection unless you explicitly tell the app otherwise. For apple its in the pinfo list file or for Android its in the manifest file

    HTH

Sign In or Register to comment.