Add support for email retrieval on sign in for X/ Twitter Oauth 2.0 #12953
alfredsadjei
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
No response
Background
Currently Auth.js does not support email retrieval on sign in for Twitter/X OAuth 2.0. Given that this feature is now supported by X API V2, it would be great to have this supported by Auth.js as well.
Proposal
Given that the
profile
callback on theOAuth2Config<Profile>
interface accepts both the entire profile retrieved by the OAuth provider as well as the retrieved token set, by modifying the twitter provider's auth scope ;we are able to simply fetch the user email (as described by x devs) and attach the resulting email data to the returned user object.
packages/core/src/lib/utils/providers.ts
Yes, I would be willing to contribute with a PR.
Beta Was this translation helpful? Give feedback.
All reactions