OAuth Client Metadata Sanitizer (src/client-metadata.ts)

better-auth · packages/oauth-provider/src/client-metadata.ts · typescript · MIT
auth, security, lang:typescript

Defines and filters OAuth client record fields, ensuring restricted metadata properties are stripped securely. Reuse when handling OAuth client registration and validation.

// Source: https://github.com/better-auth/better-auth | License: MIT | Copyright 2024 - present, Bereket Engida
// Provided via justclaw.it.com; keep this notice with the code.
import type { SchemaClient } from "./types";

/**
 * Complete internal OAuth client record vocabulary.
 *
 * `satisfies Record<keyof SchemaClient, true>` makes additions to SchemaClient
 * fail type checking until this boundary is deliberately updated.
 */
const OAUTH_CLIENT_RECORD_FIELDS = {
	clientId: true,
	clientSecret: true,
	clientDiscoveryId: true,
	disabled: true,
	scopes: true,
	clientCredentialsScopes: true,
	userId: true,
	createdAt: true,
	updatedAt: true,
	expiresAt: true,
	name: true,
	uri: true,
	icon: true,
	contacts: true,
	tos: true,
	policy: true,
	softwareId: true,
	softwareVersion: true,
	softwa

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key