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

Issues with expiring tokens - How can I persist the user authentication #42

Open
kfirstri opened this issue Sep 21, 2022 · 0 comments
Open

Comments

@kfirstri
Copy link

Amazing work on the video and these repos (this one and the functions ones)!

I had an issue with trying to make the authentication persistent -

Currently:
The user signs in -> gets a token (generated by getIdToken() on the backend) -> saves it in local storage -> every requests is being sent with a header containing the Authorization header -> FBAuth middleware uses VerifyIdToken()

Works flawlessly.. for an hour, then the token expires and my http requests start getting 403 and the auth/id-token-expired and the only way to handle this is to sign out the user and then sign in again.

Maybe I'm missing something?

Possible solutions I thought of

  • generating a custom token on the backend, verifying them and when it fails my client-side tries to signInWithCustomToken or maybe regenrate it somehow?
  • Start using the firebase client side SDK to make it handle all the work for me?

Any other thoughts? :)

Thanks!

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

1 participant