[PR #666] [MERGED] Fix "email not found" Error in Twitter OAuth #29025

Closed
opened 2026-04-17 20:25:40 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/666
Author: @LissajousOrbit
Created: 11/26/2024
Status: Merged
Merged: 12/2/2024
Merged by: @Bekacru

Base: mainHead: fix/twitter-email


📝 Commits (3)

  • 0b4601b fix: change Twitter OAuth return value
  • ddaf86d docs: Note Twitter provider uses 'username' instead of email
  • eea7da3 docs: Comment out email requirement for Twitter provider

📊 Changes

2 files changed (+10 additions, -4 deletions)

View changed files

📝 docs/content/docs/authentication/twitter.mdx (+9 -3)
📝 packages/better-auth/src/social-providers/twitter.ts (+1 -1)

📄 Description

Why is this change needed?

  • The Twitter v2 API does not return the email field.
  • However, the getUserInfo function in /social-providers/twitter expects an email value.
  • This causes a sign-in failure with the error: email_not_found when using Twitter OAuth.

Changes Made

  • Replaced the usage of the email field with the username value returned by the Twitter API.
  • Adjusted the getUserInfo function to handle this change.

Change Impact

  • Twitter OAuth now functions correctly without triggering the email_not_found error.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/666 **Author:** [@LissajousOrbit](https://github.com/LissajousOrbit) **Created:** 11/26/2024 **Status:** ✅ Merged **Merged:** 12/2/2024 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `fix/twitter-email` --- ### 📝 Commits (3) - [`0b4601b`](https://github.com/better-auth/better-auth/commit/0b4601bcaee57a1e7a8dcda543f0f2ed16a37bdd) fix: change Twitter OAuth return value - [`ddaf86d`](https://github.com/better-auth/better-auth/commit/ddaf86dd1aeb2a8bad9840fa40a6f17af44d106d) docs: Note Twitter provider uses 'username' instead of email - [`eea7da3`](https://github.com/better-auth/better-auth/commit/eea7da3e0f92210a25acfe9974bc5cc64dfbc52c) docs: Comment out email requirement for Twitter provider ### 📊 Changes **2 files changed** (+10 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/authentication/twitter.mdx` (+9 -3) 📝 `packages/better-auth/src/social-providers/twitter.ts` (+1 -1) </details> ### 📄 Description ## Why is this change needed? - The Twitter v2 API does not return the `email` field. - However, the `getUserInfo` function in `/social-providers/twitter` expects an `email` value. - This causes a sign-in failure with the error: `email_not_found` when using Twitter OAuth. ## Changes Made - Replaced the usage of the `email` field with the `username` value returned by the Twitter API. - Adjusted the `getUserInfo` function to handle this change. ## Change Impact - Twitter OAuth now functions correctly without triggering the `email_not_found` error. ## Related Issues - Fixes #591 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 20:25:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#29025