Replies: 1 comment 3 replies
-
|
You might want to try giving |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The Issue: The "Double-Hop" When using TanStack Start with a stateful backend like Laravel Sanctum, authentication works perfectly on the client because the browser automatically attaches cookies and CSRF headers. However, when moving logic into a Server Function (e.g., for beforeLoad or createServerFn()), the request originates from the Start server, not the browser.
The backend API then sees a request from a "new" client and misses the context required for stateful auth:
The Current Workaround I am currently using an Axios interceptor that uses getRequestHeaders() from @tanstack/react-start/server to manually "proxy" these values from the incoming browser request to the outgoing API request:
This feels way off. Having to manually parse cookies, xsrf token, set-cookie just doesn't seem right.
The Question Is there a more TanStack Start "native" way to handle identity propagation between the client and the server?
Beta Was this translation helpful? Give feedback.
All reactions