This repository has been archived on 2026-08-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
FarmMapsLib/projects/common/src/fm/components/auth-callback/auth-callback.component.ts
T

22 lines
710 B
TypeScript

import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { OAuthService } from 'angular-oauth2-oidc';
import { Location} from '@angular/common';
@Component({
selector: 'fm-auth-callback',
template:'<div></div>'
})
export class AuthCallbackComponent {
constructor(private router$: Router,private oauthService$:OAuthService) {
oauthService$.loadDiscoveryDocument().then(() => {
oauthService$.tryLoginCodeFlow().then(() => {
router$.navigateByUrl((oauthService$.state && oauthService$.state!="")?decodeURIComponent(oauthService$.state):"");
}).catch(() => {
router$.navigateByUrl("/");
});
})
}
}