new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Better Auth · Reference · all subjects

session

2 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

getSession on server environment requires auth.api.getSession

The authClient.getSession method does not work on server environments like Next.js server components because it cannot access cookies. Use auth.api.getSession instead and pass the request headers to it using headers: await headers(). Alternatively, you can pass request headers to authClient.getSession via fetchOptions: { headers: await headers() }.

useSession vs getSession usage

useSession is a hook that triggers re-renders when session data changes, suitable for UI that needs to respond to user or session data changes. getSession returns a promise containing data and error, suitable for situations where useSession should not be used. Do not use useSession in layout.tsx files for performance reasons; use auth.api.getSession on the server instead. getSession is available on both server and client auth instances.

Give your agent this brain