manishrasrani / ms-adal-angular6

This is a wrapper library for Angular 6+ (Angular 6.X.X and Angular 7.X.X) modules over Microsoft ADAL (Azure Active Directory Authentication Library)
https://www.npmjs.com/package/microsoft-adal-angular6
MIT License
34 stars 13 forks source link

Add an extraQueryParameter login_hint from angular component #6

Closed boonmathew closed 5 years ago

boonmathew commented 5 years ago

In the app module i am using the extraQueryParamter as follows and its working.

MsAdalAngular6Module.forRoot({`
      tenant: "xxxxxx.onmicrosoft.com",
      clientId: "xxxxxxxxxxxxxx",
      redirectUri: window.location.origin + '/home',     
      navigateToLoginRequestUrl: false,
      postLogoutRedirectUri: window.location.origin,
      cacheLocation: 'localStorage',
      extraQueryParameter: 'login_hint=abc@xyz.com'
    }),

But i am trying out to find out how to pass this extraQueryParameter: login_hint=abc@xyz.com' from a component (in a login component page on button click, i am redirecting to a URL which is protected by authencationguard in route ). Is there a was to do that. I cannot preset the login_hint in app module.

boonmathew commented 5 years ago

I was going through the source code of this library, and i added one more function in service file for adding extraquery parameters with login.

public login_userhint(loginid: string) {
    this.context.config.extraQueryParameter = 'login_hint=' + loginid;
    this.context.login();
  }

in MsAdalAngular6Service.