#How to do authenticated routes in `start` like this example?

1 messages · Page 1 of 1 (latest)

rose tartan
#

https://github.dev/tanstack/router/tree/main/examples/react/authenticated-routes

function InnerApp() {
  const auth = useAuth()
  return <RouterProvider router={router} context={{ auth }} />
}

function App() {
  return (
    <AuthProvider>
      <InnerApp />
    </AuthProvider>
  )
}

I tried to pass the auth object to the StartClient, however, context.auth is always undefined in beforeLoad function.

Is this even possible to achieve in start? As it magically passes client side data to server's beforeLoad function's arguments?

#

I am using supabase to do the authentication. I followed the supabase auth example, but it is really slow in my use case, when the user switches between protected tabs, it has to do the authentication checks every time (make requests to the supabase server).

Headless, type-safe, powerful utilities for complex workflows like Data Management, Data Visualization, Charts, Tables, and UI Components.