Skip to content
Snippets Groups Projects
app.component.ts 717 B
Newer Older
Florent Poittevin's avatar
Florent Poittevin committed
import {Component} from '@angular/core';

import {OAuthService} from 'angular-oauth2-oidc';
Florent Poittevin's avatar
Florent Poittevin committed

@Component({
  selector: 'dlcm-root',
  templateUrl: './app.component.html',
Florent Poittevin's avatar
Florent Poittevin committed
  styleUrls: ['./app.component.scss'],
Florent Poittevin's avatar
Florent Poittevin committed
})
export class AppComponent {
  title = 'DLCM-Frontend';
Florent Poittevin's avatar
Florent Poittevin committed

  constructor(private oauthService: OAuthService) {
    this.checkTokenInUrl();
  }

  private checkTokenInUrl() {
Florent Poittevin's avatar
Florent Poittevin committed
    // This method just tries to parse the token(s) within the url when
    // the auth-server redirects the user back to the web-app
    // It doesn't send the user the the login page
    // this.oauthService.tryLogin();

Florent Poittevin's avatar
Florent Poittevin committed
    const option = {
      disableOAuth2StateCheck: true,
    };
    this.oauthService.tryLogin(option);
Florent Poittevin's avatar
Florent Poittevin committed
  }
Florent Poittevin's avatar
Florent Poittevin committed
}