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.
Type Parameters
Section titled “Type Parameters”TCollectionSlug
Section titled “TCollectionSlug”TCollectionSlug extends string = string
Parameters
Section titled “Parameters”orgCollectionSlug?
Section titled “orgCollectionSlug?”TCollectionSlug
resolveOrgs?
Section titled “resolveOrgs?”boolean
sessionCollectionSlug
Section titled “sessionCollectionSlug”TCollectionSlug
userCollectionSlug
Section titled “userCollectionSlug”TCollectionSlug
Returns
Section titled “Returns”,
<DataModel>(ctx) => Promise<VexApiAuth>