How to set headers before making a network request on client-side? #1402
Unanswered
junshengpierre
asked this question in
Q&A
Replies: 1 comment
-
see here, #1408, probably that's the answer |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm using Next.js and firebase auth for authentication with next-firebase-auth and next-firebase-auth's recommended way to make an authenticated request is by passing an auth token in the
authorization
header when making the network request but the auth token is only accessible via a react hook like this:The only way I found to pass headers is to set
authToken
orAuthUser
in some global storage and then set it in the config of thewithTRPC
but wanted to see if there's an easier way to do it, is there a way to set headers directly before making a network request intrpc/@react
hooks or trpc client?Beta Was this translation helpful? Give feedback.
All reactions