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:
-
ionic plugin add cordova-plugin-ms-adal
-
Added
/// <reference path="../../plugins/cordova-plugin-ms-adal/cordova-plugin-ms-adal.d.ts" />
to typings/index.d.ts -
Added
declare var Microsoft: any
at the top of my rootAppComponent
-
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!