32 lines
1.0 KiB
TypeScript
32 lines
1.0 KiB
TypeScript
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
import { APP_INITIALIZER, Component, inject, OnInit, provideAppInitializer } from '@angular/core';
|
|
import { Router, RouterOutlet } from '@angular/router';
|
|
import { DefaultOAuthInterceptor, OAuthService } from 'angular-oauth2-oidc';
|
|
import { AppConfigService } from './services/config.service';
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
imports: [RouterOutlet],
|
|
providers: [
|
|
OAuthService,
|
|
],
|
|
templateUrl: './app.html',
|
|
styleUrl: './app.scss'
|
|
})
|
|
export class App implements OnInit {
|
|
protected title = 'Web';
|
|
constructor(private readonly as: OAuthService, private readonly router: Router) {
|
|
this.as.configure({
|
|
issuer: 'https://identity.lesko.me',
|
|
redirectUri: window.location.origin + '/login',
|
|
clientId: '21131567-fea1-42a2-8907-21abd874eff8',
|
|
scope: 'openid profile email',
|
|
responseType: 'code',
|
|
timeoutFactor: 0.01,
|
|
});
|
|
}
|
|
ngOnInit(): void {
|
|
this.as.loadDiscoveryDocumentAndLogin().then(() => this.router.navigate(['login']));
|
|
}
|
|
}
|