Is there a way not to use sessions at all?

I want to use jwt stateless authentication but when following the instructions on the following section of the documentation https://www.better-auth.com/docs/concepts/session-management#stateless-session-management it seems to be still creating a session, what I want to achieve jwt authentication where I use Authorization Header on the server side just to verify the token using a access-token + refresh-token approach, what am I missing here?


Here is my code for reference

export const auth = betterAuth({
  database: drizzleAdapter(db, {
    schema,
    provider: 'pg',
  }),
  session: {
    cookieCache: {
      version: '1.0.0', // Change the version to invalidate all sessions
      enabled: true,
      maxAge: SECONDS_IN_SEVEN_DAYS,
      strategy: 'jwt',
      refreshCache: true,
    },
  },
  emailAndPassword: {
    enabled: true,
  },
  plugins: [organization()],
});
Better Auth session management.
Was this page helpful?