new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

Better Auth · Authentication · all subjects

social sign-on setup

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

email_not_found error definition

The email_not_found error occurs during the OAuth flow when the OAuth provider does not return an email address for the user. Better Auth uses the email from the provider to identify or create a user account. If the provider omits the email or returns it as empty or undefined, the request is rejected.

email_not_found only occurs with OAuth

The email_not_found error is only possible through OAuth providers and will not occur in non-OAuth authentication flows.

Common causes of email_not_found error

The email_not_found error has five common causes: missing or insufficient scopes in the provider configuration (e.g., not requesting email); the user's email being private or not exposed by default (e.g., GitHub private email); the provider returning email only via a separate endpoint where the scope or API call was not enabled (e.g., GitHub user:email scope); provider project or tenant misconfiguration such as consent screen or admin consent issues; and using different credentials between environments (preview, staging, production) that do not request the same scopes.

Resolving email_not_found: request correct scopes

To resolve the email_not_found error, ensure the provider configuration requests the email-related scopes in the OAuth request.

Resolving email_not_found: verify provider app settings

To resolve the email_not_found error, confirm in the provider's dashboard that the app has permission to request email and the consent screen allows email access.

Resolving email_not_found: debug locally

To resolve the email_not_found error, debug locally by inspecting the outgoing authorize request to confirm the scopes include email where required; inspecting the callback payload (query parameters, id_token claims, userinfo response) to see if an email claim exists; logging the provider profile object received by the callback handler to verify whether email is present; and checking which environment's provider credentials are in use and whether scopes differ across environments.

Give your agent this brain