Currently, I am utilizing Firebase for authentication within my React application. Additionally, I have an Express server that provides a REST API. This API includes a middleware function that utilizes firebase-admin to verify the idToken sent from my app in order to authenticate access to specific routes.
The idToken issued by Firebase has a duration of one hour. If a client remains active on my app and attempts to access a route requiring an idToken after its expiration, the server will return an error message indicating unauthenticated status. While this is effective in terms of security, it may not be ideal as the user's identity is known despite the token expiration.
I have implemented code to revalidate the token, however, it consistently returns the following message: "error": "Authentication failed"
Here is the snippet of my code:
-- code block here --