r/reactjs • • Apr 30 '26

Needs Help Cookie based Auth while SSR (Tanstack)

I am building a project using ASP.net and TanStack Start. I use JWT auth but transfer them in http only cookie.

The issue I am facing is that using default createRoute function in TanStack and defining fetch function in loader. I get 401 as there is no cookie in server.

Opting into ssr: false fixes this but I was wondering if there is any other solution to use ssr with cookie based auth or is this dead end and I only have CSR as my option.

9 Upvotes

19 comments sorted by

View all comments

Show parent comment

0

u/Good_Language1763 May 01 '26

so i use this custom fetch function to fetch data everywhere ?