MSAL Plugin

Stable Version 2.0.2 (OutSystems 11)
Published on 11 Feb by 
Stable Version 2.0.2 (OutSystems 11)
Published on 11 Feb by 
Created on 20 March 2020

MSAL Plugin

Details
Use Microsoft MSAL to authenticate users in your application!
Read More

Cordova MSAL Plugin

So you want to integrate your mobile app with Microsoft's authentication service?

Note: All 2.x and higher versions of this plugin need MABS 7.x+ to build correctly. If you need to use a prior version of MABS, be sure to download version 1.x of this plugin.

This plugin implements Microsoft's MSAL plugin for Android and iOS. I'm assuming you're here because you've already read their documentation and understand how to configure Azure AD authentication for your organization and are simply looking for an existing Cordova wrapper to implement it on the mobile side.

Reading Microsoft's documentation, plus reading the README in my git repo of this plugin plus studying the demo found here should get you up to speed. Here's a quick guide:

Here's the JSON you'll need to configure your plugin. If you only have one environment and build, you can put it in your extensibility configuration in your wrapper application. But you probably have debug/release builds in multiple environments with multiple Azure clients/tenants, so LifeTime is probably the best place to manage your extensibility configuration JSON. Open your wrapper application implementing this plugin in LifeTime and click the Settings link near the application's title with the gear icon. Select your environment in the dropdown near the application's title, and scroll down to the Advanced section. Under Extensibility Configurations, tick the Custom > radial and paste your JSON with that environment's variables there:

{  
"plugin": {
"url": "https://github.com/wrobins/cordova-plugin-msal.git#v3.0.0-alpha.1",
"variables": [
{
"name": "TENANT_ID",
"value": "your-tenant-guid-here-optional"
},
{
"name": "CLIENT_ID",
"value": "your-client-guid-here-reuired"
},
{
"name": "KEY_HASH",
"value": "S0m3K3yh4shH3re="
}
]
}
}

You can specify three variables during installation\: the tenant ID and client ID of your Identity Platform, and, if you're building for Android, a base64 sha1 hash of your keystore file. The latter of which can be obtained like this:

keytool -exportcert -alias yourkeystorealias -keystore path/to/your/keystore/file.keystore | openssl sha1 -binary | openssl base64

If you aren't using AzureADMyOrg as one of your authorities, you can omit TENANT_ID, and if you're only building for iOS, you can omit KEY_HASH, but you really need to provide CLIENT_ID.

You need to call the MsalInit action before you do anything else with the plugin. It tells the plugin how to function. You can call it without changing any of the input parameters, or you can modify them to suit your app. The options basically mimic Microsoft's published configuration and are documented in Service Studio's descriptions.

What’s new (2.0.2)
  • Fixed a bug in iOS where an incorrect structure was being returned from SignInInteractive.
  • If you are overriding the extensibility configurations in LifeTime (which you should be), make sure you update the URL to the correct GIT version before rebuilding your app: 

{

    "plugin": {
         "url": "https://github.com/wrobins/cordova-plugin-msal.git#v3.0.0-alpha.1"

    ... 

Reviews (1)
2020-05-07
in version 1.1.1
Works as intended out of the box. Some knowledge on Azure AD required.
Category
Functional libraries & utilities, Security & authentication
Support Options
This component is not supported by OutSystems. You may use the discussion forums to leave suggestions or obtain best-effort support from the community, including from Walter Robins who created this component.
Dependencies
See all 1 dependencies
Requirements
Platform:
11.0.0.200
Database:
All
Stack:
.NET
Component Consumers
No consumers yet.
Weekly Downloads