JamalJ
Convex Community3y ago
8 replies
Jamal

React Server Components + Convex Auth State Support?

So im in my nextjs app the convex docs says to use the
useConvexAuth
hook.
const { isAuthenticated} = useConvexAuth();

hook makes sure that the browser has fetched the auth token needed to make authenticated requests to your Convex backend

However, you cant use Hooks in RSC, so is it not possible for convex to know the auth state on the server side? Im asking because i want to fetch data on the server side and pass it to my client components as props. Avoiding having to do a lot of api calls from the client side. I know I can use the Js http client but im not sure how to handle auth session from there. And I want most of my business logic to stay on the server.
Was this page helpful?