Correcciones ejemplo

This commit is contained in:
Eneko Nieto
2021-01-18 23:59:14 +01:00
parent 3680dd6c2c
commit 9d6bc0dd1b
8 changed files with 35 additions and 120 deletions

View File

@@ -1,6 +1,5 @@
import { authConfig } from './auth.config';
import { Component } from '@angular/core';
import { OAuthService, NullValidationHandler } from 'angular-oauth2-oidc';
import { OAuthService } from 'angular-oauth2-oidc';
import { Router } from '@angular/router';
import { filter } from 'rxjs/operators';
import { authCodeFlowConfig } from './auth-code-flow.config';
@@ -19,14 +18,15 @@ export class AppComponent {
this.oauthService.events
.pipe(filter((e) => e.type === 'token_received'))
.subscribe((_) => {
console.debug('state', this.oauthService.state);
console.log('state', this.oauthService.state);
this.oauthService.loadUserProfile();
});
}
private configureCodeFlow() {
private configureCodeFlow(): void {
this.oauthService.configure(authCodeFlowConfig);
this.oauthService.loadDiscoveryDocumentAndTryLogin().then((_) => {
this.oauthService.loadDiscoveryDocumentAndTryLogin().then((success) => {
console.error('LOGIN success=' + success);
if (useHash) {
this.router.navigate(['/']);
}