TomT
tRPC3y ago
6 replies
Tom

is there a way to do client-side "middleware"?

My app uses Firebase Auth for authentication. While the user is logged in, they get an ID token which is valid for 1 hour (non-configurable). The front-end is supposed to call a function await user.getIdToken() to refresh this token.

Is there a way that I can have the frontend try a request, examine the response, potentially call this function if the server tells me the token is expired, and then retry? I want this to happen without triggering the onError() callback for all of my queries / mutations if possible.
Was this page helpful?