AuthHelpersOptions
AuthHelpersOptions<
TUser> =object
Defined in: packages/auth/src/helpers.ts:9
Options for createAuthHelpers.
Type Parameters
Section titled “Type Parameters”TUser extends AuthUser = AuthUser
The application-specific user type. Defaults to
AuthUser when no enrichUser hook is provided.
Properties
Section titled “Properties”enrichUser()?
Section titled “enrichUser()?”
optionalenrichUser: (user) =>Promise<TUser> |TUser
Defined in: packages/auth/src/helpers.ts:37
Optional hook to extend the base AuthUser with app-specific fields
(e.g., vendorId, custom profile data).
When provided, every helper that returns a user will pass the base user
through this function before returning. The enriched user type TUser
flows through to all return types.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<TUser> | TUser
Example
Section titled “Example”const helpers = createAuthHelpers({ getAuth, enrichUser: async (user) => { const vendor = await lookupVendor(user.id); return { ...user, vendorId: vendor?.id ?? null }; },});getAuth()
Section titled “getAuth()”getAuth: () =>
AuthInstance
Defined in: packages/auth/src/helpers.ts:17
Factory that returns an initialized AuthInstance.
Called on every helper invocation to guarantee fresh env bindings on Cloudflare Workers (where module-scope closures can survive across requests inside the same isolate).