abacritt / angularx-social-login

Social login and authentication module for Angular 17
630 stars 387 forks source link

Logout not working after once the browser is refreshed #586

Closed Nilbristi closed 1 year ago

Nilbristi commented 1 year ago

After successful login, I can enter my application and everything is working fine. But if I refresh the page and after that try to do socialLogout, I am getting an error. The plugin should auto-track the login status after a user refreshes the page.

The error I am getting below:

image

professor-rage commented 1 year ago

Regarding Google Auth, this has me unsure how to proceed with the following scenario.

Every refresh of the browser requires the user to login again. You can listen to the authState using this.authService.authState.subscribe() but will not trigger unless the user clicks lthe login button again.

Scenario 1: If user logs in and the browser is never refreshed, if they signout of web app, then this.authService.signOut() works appropriately.

Scenario 2: If user logs in, then closes browser, then opens the browser/web app again, through web app's auth persistence, they are still logged in, but no longer logged in to google, so when they signout of web app, this.authService.signOut() fails with the error above.

Question, any methods/mechanisms to persist google auth when browser is refreshed? Instead of always being logged off when the browser is closed?

TIA

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.