> ## Content Index
> Fetch the complete content index at: https://catalins.tech/llms.txt
> Use this file to discover other available public pages before exploring further.

# GitHub OAuth Returns error=email_not_found
- URL: https://catalins.tech/github-oauth-email-not-found/
- Published: 2024-12-17T14:32:01.000Z
- Updated: 2024-12-17T14:32:01.000Z
- Author: Catalin Pit
- Tags: GitHub

Your GitHub OAuth implementation may return the error "email not found" when a user logs in with their GitHub account if their email address is set to private.

![](https://catalins.tech/content/images/2024/12/github-keep-email-private.webp)

If the user has the option "[*Keep my email addresses private*](https://github.com/settings/emails)" checked, GitHub returns the `null` value for the email. As a result, your authentication flow breaks.

The user must uncheck the "*Keep my email addresses private*" option and select a public email. After that, the GitHub authentication should work correctly.

![](https://catalins.tech/content/images/2024/12/github-public-email.webp)

I didn't check whether there is a workaround without relying on the user to have a public email address. I'm using an auth library that doesn't allow me to change the underlying API, so this is the only option in my case.