Azure Mobile Services .NET Adds CORS Support, Better Authentication

Support for cross-origin resource sharing now built in via the ASP.NET Web API.

Microsoft's Azure Mobile Team has an update to its Azure Mobile Services .NET that adds has built-in support for the cross-origin resource sharing specification, as well as improved authentication.

Azure Mobile Services is aimed at mobile developers who want to plug in a cloud-hosted backend to their mobile apps. It uses the ASP.NET Web API and is fully supported in the Visual Studio IDE.

Cross-origin resource sharing is a specification for standardizing cross-domain requests that bypasses JavaScript's same-origin policy. The CORS support in Azure Mobile Services .NET comes by way of support now embedded in the ASP.NET Web API 2.2 Cross-Origin Support 5.2.0 package, which can be downloaded via this Nuget package.

CORS is not enabled by default in Azure Mobile Services .NET, and must be turned on through the Azure management portal or set through the MS_CrossDomainOrigins app setting. Once done, CORS policy can be set at "a per-service, per-controller, or per-action level," blogs Henrik Frystyk Nielsen, principal architect for Microsoft Azure Mobile Services.

Authentication methods have also been improved. Besides authentication via Azure Active Directory, Twitter, Facebook, Google, and Microsoft Account, other authentication methods can be customized. Nielsen writes of an example using LinkedIn authentication that uses an OWIN middleware and registration of that package through the LoginProvider.

Azure Active Directory Authentication has been built in from the beginning, but Nielsen writes that it has been improved "using a server-side flow simplifying client authentication significantly."

Details and download instructions are here.

About the Author

You Tell 'Em, Readers: If you've read this far, know that Michael Domingo, Visual Studio Magazine Editor in Chief, is here to serve you, dear readers, and wants to get you the information you so richly deserve. What news, content, topics, issues do you want to see covered in Visual Studio Magazine? He's listening at [email protected].

comments powered by Disqus


  • Death of the Dev Machine?

    Here's a takeaway from this week's Ignite 2020 event: An advanced Azure cloud portends the death of the traditional, high-powered dev machine packed with computing, memory and storage components.

  • COVID-19 Is Ignite 2020's Elephant in the Room: 'Frankly, It Sucks'

    As in all things of our new reality, there was no escaping the drastic changes in routine caused by the COVID-19 pandemic during Microsoft's big Ignite 2020 developer/IT pro conference, this week shifted to an online-only event after drawing tens of thousands of in-person attendees in years past.

  • Visual Studio 2019 v16.8 Preview Update Adds Codespaces

    To coincide with the Microsoft Ignite 2020 IT pro/developer event, the Visual Studio dev team shipped a new update, Visual Studio 2019 v16.8 Preview 3.1, with the main attraction being support for cloud-hosted Codespaces, now in a limited beta.

  • Speed Lines Graphic

    New for Blazor: Azure Static Web Apps Support

    With Blazor taking the .NET web development world by storm, one of the first announcements during Microsoft's Ignite 2020 developer/IT event was its new support in Azure Static Web Apps.

  • Entity Framework Core 5 RC1 Is Feature Complete, Ready for Production

    The first release candidate for Entity Framework 5 -- Microsoft's object-database mapper for .NET -- has shipped with a go live license, ready for production.

Upcoming Events