0
votes

I need to authenticate my Xamarin forms app with username and password stored in a database table accessible via an Azure mobile app.

We have an Asp.Net web app that users Forms authentication which has its data synched to an Azure SQL database (to user online/offline sync). I then use an Azure Mobile app to access the SQL data and use the Azure Mobile app as the backend for my Xamarin Forms app. We would like the users to log on to the Xamarin app with the same credential that they use for the web app.

Using walk throughs I have been able to get an app authenticating with Google, Azure active directory, etc. but is there a way of using the credentials stored in the Azure SQL database table? For the record I have very little experience with authentication.

I have found this https://github.com/HoussemDellai/CheapIdeas which uses the example of a Web API backend, will this work with an Azure Mobile App backend, aren't they essentially the same thing?

1

1 Answers

0
votes

I need to authenticate my Xamarin forms app with username and password stored in a database table accessible via an Azure mobile app.

According to your requirement, I assume that you could use App Service Authentication / Authorization and follow adrian hall's book about Custom Authentication to create the custom CustomAuthController endpoint in your Azure Mobile App backend project.

For your Xamarin client, you could use Azure Mobile Client SDK and login via the following code snippet:

MobileServiceClient.LoginAsync("custom", JObject.FromObject(new User { Username = "<userName>", Password = "<userPassword>" }));

For a quick way, you could follow Create a Xamarin.Forms app to download the Mobile Apps back end, then create your CustomAuthController ApiController and deploy to Azure.