ADAL for Cordova - Microsoft not defined error?


Hello all,

I’m having an identical problem as found in this thread:

I’m trying to add the ADAL library for Cordova plugin, but am getting a 'Microsoft' is not defined error whenever I use it (Microsoft being the namespace where the ADAL library lives). What’s strange is that I receive no compile errors in my VS Code Project and it seems to pick up on the library’s members; it only fails during runtime.

Here’s what I’ve done, per the previous thread:

  1. ionic plugin add cordova-plugin-ms-adal

  2. Added /// <reference path="../../plugins/cordova-plugin-ms-adal/cordova-plugin-ms-adal.d.ts" /> to typings/index.d.ts

  3. Added declare var Microsoft: any at the top of my root AppComponent

  4. Added this inside
    let context = new Microsoft.ADAL.AuthenticationContext(''); context.acquireTokenAsync("", "[APP ID]", "http://localhost:8000").then((res) => { console.log(res); });

I still get the error, both in the web and iOS project. Anyone know what could be wrong? Thanks!


@jvall - just checking if you were able to resolve the issue. I am getting the same error and looked around everywhere but nothing worked so far.

Any help will be greatly appreciated.