Maps Better Auth OAuth link errors to localized message keys for account settings pages.
// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
const linkedAccountOAuthErrorMessageKeys: Record<string, string> = {
account_already_linked_to_different_user: 'settings.pages.account.connections.error.accountAlreadyLinkedToDifferentUser',
}
/**
* Resolves Better Auth OAuth-link callback errors to settings-page i18n keys.
*
* Use when:
* - A link-social callback redirects back to an account settings page with
* `?error=...`.
*
* Expects:
* - `errorCode` is the raw query-string value from Better Auth.
*
* Returns:
* - A specific localized message key for known errors.
* - A generic localized message key for unknown non-empty errors.
* - `null` when there is no err
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key