Getting session in loader

Hi all, I'm trying to validate the session in my route loader. I can't see anything in the docs about this, so I did it like this export async function loader({ request }: LoaderFunctionArgs) { const session = await auth.api.getSession({ headers: request.headers, }); console.log("session:", session); ... } The problem is that the session I'm getting is null.
Solution:
Solved the problem — the better-auth session cookie was not being passed during login.
Jump to solution
1 Reply
Solution
devadnqpnd
devadnqpnd5mo ago
Solved the problem — the better-auth session cookie was not being passed during login.

Did you find this page helpful?