TanStackT
TanStack7mo ago
19 replies
urgent-maroon

How to protect server functions?

Hi! I'm using the start-clerk-basic example (https://github.com/TanStack/router/tree/main/examples/react/start-clerk-basic) to start a project and I can see how we can require authentication on the front-end, but if I try to call the endpoint generated by the server function on Postman, it works even without login. What would be the best practice to do this with a global middleware? Any examples?
GitHub
🤖 Fully typesafe Router for React (and friends) w/ built-in caching, 1st class search-param APIs, client-side cache integration and isomorphic rendering. - TanStack/router
router/examples/react/start-clerk-basic at main · TanStack/router
Was this page helpful?