I am using Angular 11 with version 10 of augular-oauth-oidc
Is this the correct way to check whether the user is currently logged in?
@Injectable({
providedIn: 'root'
})
export class AuthService {
constructor(
private oauthService: OAuthService,
private router: Router,
) {
.
.
.
isLoggedIn(): boolean {
const identityClaim = this.oauthService.getIdentityClaims();
return identityClaim && identityClaim['name'] ? true : false;
}
I feel this is hacky... I am just checking whether the name field exists within identity?
How does this prevent a user from just modifying this variable in his console - apart from server sided checks upon api submission or something.
Does Angular route guard and interceptor do this job?
Thanks!