Skip to content

createGetAuth

createGetAuth<TCollectionSlug>(props): <DataModel>(ctx) => Promise<VexApiAuth>

Defined in: packages/better-auth/src/convex/getAuth.ts:26

Builds the getAuth resolver for collectionsApi from better-auth’s conventions — no per-app auth plumbing.

Resolution chain, all from the validated JWT the convex() better-auth plugin mints: identity.subject (user doc id) → user document; identity.sessionId (appended to every token by the plugin) → session document → session.activeOrganizationId → organization document. Documents are read fresh on every request, so role changes and org switches apply immediately — claims are only used as ids, never as authorization data.

orgCollectionSlug is only required when resolveOrgs is true — a project with organizations disabled can omit it entirely. Passing resolveOrgs: true without an orgCollectionSlug skips org resolution (same as resolveOrgs: false) rather than throwing, since the omission is a config mistake, not a request-time error worth failing loudly for.

TCollectionSlug extends string = string

TCollectionSlug

boolean

TCollectionSlug

TCollectionSlug

,

<DataModel>(ctx) => Promise<VexApiAuth>

VexApiAuth