t
tRPC
t
tRPC
How to set up protected route with Firebase Auth?
Original message was deleted
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,111
Members
View on Discord
N
Nick
•
3/10/23, 10:11 PM
You can write your own tRPC middleware and put the user in Context
N
Nick
•
3/10/23, 10:11 PM
https://trpc.io/docs/middlewares
Middlewares | tRPC
You are able to add middleware
(s
) to a procedure with the t
.procedure
.use
(
) method
. The middleware
(s
) will wrap the invocation of the procedure and must pass through its return value
.
N
Nick
•
3/10/23, 11:10 PM
I think you
're figuring it out yes
N
Nick
•
3/10/23, 11:25 PM
headers can be an async function I believe
, so you can await that
N
Nick
•
3/10/23, 11:25 PM
I would call getAuthToken inline there too
, not in the component
.