0

Building an angular app. Right now, I'm only trying to get the mgt-person element to render, but it refuses.

First, I installed with npm i @microsoft/mgt. That causes a runtime error because I have strict type checking on. I uninstalled it and went with what I needed. Installed the mg-components and mgt-element libraries.

Here's my AppComponent code.

ngOnInit() {
    Providers.globalProvider = new SimpleProvider(this.getAccessToken, this.login, this.logout);
    // getUserComputed makes sure the user is loaded in my service and ready to use
    this.oidc.getUserComputed().subscribe(() => Providers.globalProvider.setState(ProviderState.SignedIn));
}

signOut() {
    this.auth.signOutRedirect();
}

getAccessToken(options): Promise<string> {
    const obs = this.oidc.getUserComputed().pipe(map(x => x.access_token));
    return firstValueFrom(obs);
}

login(): Promise<void> {
    const obs = this.oidc.signIn();
    return firstValueFrom(obs);
}

logout(): Promise<void> {
    const obs = this.oidc.signOut();
    return firstValueFrom(obs);
}

<mgt-person person-query="me" view="twoLines"></mgt-person>

What am I missing? The getAccessToken method is never invoked.

Luminous
  • 1,771
  • 2
  • 24
  • 43

0 Answers0