MCPcopy
hub / github.com/BuilderIO/agent-native / mapBetterAuthSession

Function mapBetterAuthSession

packages/core/src/server/auth.ts:960–971  ·  view source on GitHub ↗

* Map a Better Auth session to our AuthSession type.

(baSession: {
  user: { id: string; email: string; name?: string };
  session: { token: string; activeOrganizationId?: string };
})

Source from the content-addressed store, hash-verified

958 * Map a Better Auth session to our AuthSession type.
959 */
960function mapBetterAuthSession(baSession: {
961 user: { id: string; email: string; name?: string };
962 session: { token: string; activeOrganizationId?: string };
963}): AuthSession {
964 return {
965 email: baSession.user.email,
966 userId: baSession.user.id,
967 name: baSession.user.name,
968 token: baSession.session?.token,
969 orgId: baSession.session?.activeOrganizationId ?? undefined,
970 };
971}
972
973/**
974 * Get the current auth session for a request.

Callers 1

getSessionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected