AzureAD / azure-activedirectory-library-for-cordova

ADAL for Cordova
59 stars 112 forks source link

facing version issue #183

Open bhumin3i opened 6 years ago

bhumin3i commented 6 years ago

projectFolder>cordova plugin add cordova-plugin-ms-adal@0.8.x --save

Installing "cordova-plugin-ms-adal" for android
Installing "cordova-plugin-compat" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 7.0.0, failed version requirement:
      <6.3.0
Skipping 'cordova-plugin-compat' for android
Android Studio project detected
Subproject Path: CordovaLib
Subproject Path: app
Adding cordova-plugin-ms-adal to package.json
Saved plugin info for "cordova-plugin-ms-adal" to config.xml

And also i got en error "cannot read property msADAL of undefined ":

code :

    this.oAuthLogin(this.authUrlEmail).then(success => {
        console.log('User sucess', success);
        this.doLogin(postData,success);
      }, (error) => {
     //always  come in this section
       this.presentYourModal(error);
      });
  public oAuthLogin(finalAuthUrl): Promise<any> {
    return new Promise(function (resolve, reject) {
      let authContext: AuthenticationContext = this.msADAL.createAuthenticationContext('https://login.windows.net/common');
      authContext.acquireTokenAsync('https://graph.windows.net',this.global.clientID, 'mycallbackURL')
      .then((authResponse: AuthenticationResult) => {
      alert('Token is ' + authResponse.accessToken);
      alert('Token will expire on '+ authResponse.expiresOn);
      resolve(authResponse.accessToken);
      })
      .catch((e: any) =>alert('Authentication failed '+ e));
    });
  }

How we handled Promise...

i got error like:

ErrorCode:invalid_client ErrorDescription:AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.