We are happy to announce the support for MSAL.NET (Microsoft Authentication Library) on WebAssembly.
This addition allows developers to cross-target use Azure AD, Azure AD B2C and ADFS authentication when building mobile, web and desktop applications.
You will now able to access the Microsoft Graph API from your WebAssembly application. This new integration allows accessing any resources protected by Azure Authentication.
Benefits of using Microsoft Authentication Library (MSAL) in enterprise applications
Adding the Microsoft Identity Platform (MSAL) to your project will allow easy universal authentication of your users across the web and your local servers.
For example, by getting a security token to access Microsoft Graph API you could:
• Search for a document on SharePoint
• Check for conference room availability
• Get user thumbnail
• Look-up an employee in the corporate directory
• … or any other part of the Graph API
You can use it as an SSO (Single Sign-On) to your own backend or 3rd party services.
Authentication on WebAssembly – no longer a missing piece for true enterprise applications
Uno Platform support for MSAL was already available using .net standard 1.3 on Android, iOS and macOS platforms but it was lacking support for in-browser WebAssembly applications. In particular interactive authentication was not possible. With Uno Platform support for MSAL.NET it is now possible to build multi-platform enterprise applications which include Web, including interactive authentication.
In addition to MSAL support for WebAssembly, this release also include helpers to minimize the friction when developing for MSAL-enabled application iOS, macOS and Android such as having to do fewer platform-specific tweaks to enable the authentication itself.
The source code for a demo application we built using Uno Platform and MSAL for WebAssembly is available for you to learn from. This demo also contains instructions to use your own Azure AD registration.
Steps to use your own Azure AD App Registration with Uno Platform
1. Register an app in your Azure AD as a Single-page Application with the following Return-URI:
http://localhost:5000/authentication/login-callback.htm
2. Copy Client ID & Tenant ID in the MainPage.xaml.cs page
3. Launch the app using Kestrel (not IIS Express, to force the use of the port 5000)
4. A more detailed step-by-step in the README of the repo
Detailed Documentation for using MSAL and Uno Platform
You’ll need to familiarize yourself with the very good MSAL documentation.
On Azure AD, register your Uno WebAssembly application as if you were creating a JavaScript SPA application using MSAL.js.
You can also consult the Uno MSAL documentation to know more.
Note: The Uno.UI.MSAL package is available in pre-released version 3.0.0-dev.471+. You may need to activate the “Include prerelease” flag in the NuGet package manager of VisualStudio to see it.
Carl de Billy on behalf of the Uno Platform team. Carl is Senior Software Architect on Uno Platform core team.