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:Jump to solution
Solved the problem — the better-auth session cookie was not being passed during login.
1 Reply
Solution
Solved the problem — the better-auth session cookie was not being passed during login.