Y0z64
Is there a way to pass context or cookies to the client provider?
I have the authorization cookies stored in HTTP-only cookies but I need to pass them to the api provider wich is client side without exposing the cookies.
I have the session cookies which contain the authorization token in the TRPC context but I cannot find a way to pass the context from there to the client provider.
Anyone knows a way I can set this header using my cookies either with context, passing the cookie directly or any other aproach?
Thanks in advance
2 replies
Is there a way to pass context or cookies to the client provider?
I have the authorization cookies stored in HTTP-only cookies but I need to pass them to the api provider wich is client side without exposing the cookies.
I have the session cookies which contain the authorization token in the TRPC context but I cannot find a way to pass the context from there to the client provider.
Anyone knows a way I can set this header using my cookies either with context, passing the cookie directly or any other aproach?
Thanks in advance
2 replies
Get auth token from context when defining httpBatchLink
Im setting up an ApiProvider for react query and I want to get the authorization token for the Authorization header from trpc context since my session is stored there.
My api is defined here
And this is the definition of my apiProvider
Is there any way to pass the context to the createClient function? or al least just get the context in any way so I can assign the token value to the one in context
2 replies