Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent authState Callback Trigger on Logout/Return to Login Page. #740

Open
Tweniee opened this issue Dec 5, 2023 · 2 comments
Open

Comments

@Tweniee
Copy link

Tweniee commented Dec 5, 2023

When implementing Google login, the this.authService.authState.subscribe() callback in the Login.component.ts is subscribed. However, upon user logout and returning to the login page, the authState callback is triggered again, creating the impression of logging in anew. Despite attempting to unsubscribe from the observable, the issue persists.

// In Login.component.ts
// Subscribe to authState callback
const authSubscription = this.authService.authState.subscribe((user) => {
  this.user = user;
  this.loggedIn = (user != null);
});

// ...

// Upon logout or component destruction, unsubscribe to prevent unwanted triggers
ngOnDestroy() {
  authSubscription.unsubscribe();
}

Despite the effort to unsubscribe using authSubscription.unsubscribe(), the callback is still being invoked.

@Tweniee Tweniee changed the title Not Able to logout Persistent authState Callback Trigger on Logout/Return to Login Page. Dec 5, 2023
@Tweniee
Copy link
Author

Tweniee commented Dec 5, 2023

Before anyone says anything, last month it was working fine.

@hardcorelite
Copy link

window.location.reload();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants