Maps Better Auth roles to Polar organization roles for authentication adapters.
// Source: https://github.com/polarsource/polar | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import type { AuthContext } from 'better-auth'
import type {
BetterAuthRoleMappingInput,
BetterAuthRoleMappingOptions,
PolarMemberRole,
} from './types'
export const DEFAULT_BETTER_AUTH_CREATOR_ROLE = 'owner'
const DEFAULT_BILLING_MANAGER_ROLES = ['admin'] as const
export const getBetterAuthOrganizationPlugin = (
authContext: Pick<AuthContext, 'getPlugin'>,
) => authContext.getPlugin('organization')
export const getBetterAuthCreatorRole = (
authContext: Pick<AuthContext, 'getPlugin'>,
): string =>
getBetterAuthOrganizationPlugin(authContext)?.options.creatorRole ??
DEFA
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key