import { Component, Inject, Injector } from '@angular/core'; import { FooterComponent, HeaderComponent, SidebarComponent } from '../public-api'; import { OKTA_AUTH, OktaAuthModule } from '@okta/okta-angular'; import OktaAuth from '@okta/okta-auth-js'; import { OktaTokenService } from './okta-token.service'; @Component({ selector: 'lib-angular-lib', standalone: true, imports: [ OktaAuthModule ], template: `

angular-lib works!

`, styles: `` }) export class AngularLibComponent { userName: string | undefined = ''; constructor ( private oktaService: OktaTokenService, @Inject(OKTA_AUTH) private oktaAuth: OktaAuth, ) { this.oktaService.setAccessToken(this.oktaAuth.getAccessToken() as string); this.oktaService.hasTokenExpired(); this.getUserDetails(oktaService); } ngOnInit() { } async getUserDetails(oktaService: OktaTokenService) { try { const user = await this.oktaAuth.getUser(); oktaService.userName = user.name; this.userName = user.name; oktaService.setEmployeeNumber(Number(user['employeeNumber'])); } catch (error) { console.log(error); } } }