Closed luc122c closed 1 year ago
Can you dive a bit more in the proposed solution?
Sure. Althrough I'm not sure on the mechanism that Vuefire uses, the docs suggest that during SSR, data is serialised and then hydrated on the client side.
My suggestion would be that if the token has expired, send some additional metadata using the same mechanism, then check for this on the client side. If it is detected by the client plugin, call getIdToken
to refresh the token and update the cookie.
I did a few changes to avoid the page to crash when the token expires. I think the firebase js sdk automatically refreshes the token (I tested this locally). Is there anything left to do?
As long as the refreshed token gets updated in the cookie, then all should be good :) Thank you!
What problem is this solving
Currently, when Firebase reports an expired token (
auth/id-token-expired
), vuefire simply logs the error.Proposed solution
When the server component encounters this error, it could pass a message to the frontend to refresh the token. This can be achived with
getIdToken($user, true)
.Describe alternatives you've considered
Logging out and in again also clears the issue.