How do i read auth tokens during http request with axios?
I want to call react query inside loader but my axios don't have auth tokens in header (currently doing session cookie)
but my auth is being failed due to lack of auth tokens.
how do i handle auth tokens in ssr pages?
7 Replies
tame-yellow•4mo ago
which scenario is this? in the SSR request you want axios to use the cookie the client sent to start?
afraid-scarletOP•4mo ago
yeah.
i digged in
createServerFn and it seems like we can get client cookie and headers in this server fn
something liket this.
is it ok to do lke this?
I am getting ts error while returning getVendors(),
i can fetch data like this with correct credentials
but now what do I do with tanstack query ?
how do I ensureQueryData if i am fetching directly with server Fn
@Manuel Schillertame-yellow•4mo ago
what's the request URL here?
is this one from start? or a different backend?
afraid-scarletOP•4mo ago
it's a different backend
tame-yellow•4mo ago
you could use different query functions depending on whether you are on the server or on the client
quickest-silver•4mo ago
it's createIsomorphicFn , is it ?
tame-yellow•4mo ago
yes sorry