Ensure configuration options are handled uniformly across all API endpoints and providers. Configuration should have clear precedence rules, support dynamic values where appropriate, and avoid hardcoded fallbacks.
Key principles:
Example of good configuration handling:
// Bad: Unclear precedence and hardcoded fallback
const consentURI = `${options.consentPage}?client_id=${client.clientId}&scope=${requestScope.join(" ")}`;
// Good: Clear precedence and proper encoding
const url = new URL(options.consentPage);
url.searchParams.set('consent_code', encodeURIComponent(code));
url.searchParams.set('client_id', encodeURIComponent(client.clientId));
url.searchParams.set('scope', encodeURIComponent(requestScope.join(' ')));
// Bad: Static configuration only
team: string;
// Good: Dynamic configuration support
team?: string | ((ctx: Context) => string);
This ensures developers have predictable behavior, proper flexibility, and consistent patterns across the entire API surface.
Enter the URL of a public GitHub repository