tRPCttRPC
Powered by
TomT
tRPC•3y 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()
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.
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

is there a way to fetch real time data in server side instead of client side(invalidate)?
jaacsenJjaacsen / ❓-help
2y ago
Recommended way to prefetch client-side
pbeshPpbesh / ❓-help
4y ago
Is there a way to transform data server-side only?
nehalistNnehalist / ❓-help
3y ago
is there a better way to do this?
SansPapyrus683SSansPapyrus683 / ❓-help
2y ago