abacritt / angularx-social-login

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

SocialUser is stored in Local Storage #625

Closed klimaschkas closed 1 year ago

klimaschkas commented 1 year ago

As mentioned in issues #586 and #522, when using the Google provider, a reload of the page will effectively log-out the user. This is because the SocialUser (or the id token) are only stored in memory in the SocialAuthService.

In this PR, every successfull authentication is stored in Local Storage and will therefore also survive a page reload. After a page reload, the SocialAuthService checks first if there are valid Google credentials and restores them to the service. Also, a timer is started, that will refresh the user when the id token becomes invalid.

Feel free to comment or add suggestions, this is my first time contributing :)

klimaschkas commented 1 year ago

Just realized there is an issue with getting access tokens, I'll commit the fix when I found it.

josephfo commented 1 year ago

ETA on when this will make it to master?

klimaschkas commented 1 year ago

Felt like the way this library was designed didn't allow for what I needed, so I created a new library wrapping around google social login: https://github.com/klimaschkas/ngx-sign-in-with-google