ADAL for Cordova - Microsoft not defined error?


#1

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 platform.read().then():
    let context = new Microsoft.ADAL.AuthenticationContext('https://login.microsoftonline.com/common'); context.acquireTokenAsync("https://graph.microsoft.com", "[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!


#2

@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.