feat: implement authentication flow and dynamic API configuration #5
This commit is contained in:
9
Web/src/app/app.route.guard.ts
Normal file
9
Web/src/app/app.route.guard.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { CanActivateFn } from '@angular/router';
|
||||
import { inject } from '@angular/core';
|
||||
import { OAuthService } from 'angular-oauth2-oidc';
|
||||
|
||||
|
||||
export const authGuard: CanActivateFn = (route, state) => {
|
||||
const authService = inject(OAuthService);
|
||||
return authService.hasValidAccessToken(); // returns boolean, Promise, or Observable
|
||||
};
|
||||
Reference in New Issue
Block a user