Ionic, MS-ADAL, Microsoft Azure AD

Hi all,

I’m facing a wall right now trying to implement SSO with MS-ADAL module in my Ionic application.

I just can’t get a valid authenticationContext using Microsoft Azure AD, in which I registered my application.

I can’t know if this is because I didn’t set all parameters on Azure portal correctly (I tried to find a clear tutorial on it, found many many super complicated ones, not even one close enough to S-I-M-P-L-E )

Herebelow is my code :

import { Injectable } from '@angular/core';
import { JwtHelperService } from '@auth0/angular-jwt';
import { Platform} from 'ionic-angular';

import { MSAdal, AuthenticationContext } from '@ionic-native/ms-adal';

import { environment as env } from '../environments/environment';
export class AuthService {
    private msAdal: MSAdal,
    private jwtHelper: JwtHelperService,
    private platform: Platform,
    //private AuthContxt: AuthenticationContext
  ) {
    console.log("auth.service.ts constructor");
    platform.ready().then(() => {
      console.log('Activate ADAL logger');
      //Microsoft.ADAL.AuthenticationSettings.setLogger(logItem => {
      //  console.log(`ADAL: ${logItem.message}`, logItem);

public async authenticate(): Promise<boolean> {
    await this.platform.ready();
    const authContext = this.msAdal.createAuthenticationContext(

And as for the environment is concerned here is part of the file :

export const environment = {
  //adAuthority: '',
  adAuthority: '',

  //adResourceUri: '',
  adResourceUri: '',

  adClientId: '<<<here is the client id I took from Azure portal>>>',

  adRedirectUri: 'https://localhost:8100/',
  // -------------------------------------
  // partie dédiee a la connexion a l'API
  // -------------------------------------

Is my adAuthority wrong ? tried the but it returns a 404 in chrome when I put it as a URL …

Indeed the error is that my ‘authContext’ is undefined which leads logically to nothing when trying to get tokens afterwards :cry: