abacritt / angularx-social-login

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

socialAuthService.signout doesn't clear the user and I can't stop autologin. #764

Open AlejandroFlorin opened 2 months ago

AlejandroFlorin commented 2 months ago

I'm on 2.0.0

When I call socialAuthService.signOut(). The service's user property isn't cleared. Is that expected behavior?

The reason I ask is because I have a login component that subscribes to authState which works great. I also have a logout component that routes back to the login component.

The issue I'm running into is that when the login component is re initialized when routed to from logout, the authservice still thinks the user is logged in and is firing my code to load the post login UI for the user (when they should remain logged out). The autologin flag is set to false BTW.

I have registered the providers in one place (app.module.ts) and subscrbing to the service solely in the login component.

My workaround has been to detect that the login page was reached via a logout reroute and doing a location.reload to clear the service (which is hacky as hell)>. I tried unsubscribing from the autservice but that didn't work.

Thanks

PRE-ShashankPatil commented 1 week ago

Hi, guys any updates ?

Specially in case of Microsoft, i wanted to my application should logout instead of Microsoft account logout popup.

dimeloper commented 1 week ago

Facing the exact same problem. Are there any known workarounds?