Improve Twitter/X OAuth provider to support fetching user email in the X API v2
#18466 opened on Dec 1, 2025
Description
Is your feature request related to a problem?
Currently, the Twitter/X OAuth source in Authentik does not fetch the user email (because not requested). This prevents the system from populating the email field for users authenticating via Twitter/X. Unlike Facebook, which specifies custom fields (e.g., email) via the fields query parameter and handle the email scope in get_additional_parameters method, the Twitter provider does not handle it.
Here is the announcing support for email address retrieval with OAuth 2.0 in the X API v2.
Important: To receive the email from X, the app must have the “Request email from users” permission enabled in the X Developer dashboard. Without this permission, the API will not return the email even if requested.
Describe the solution you'd like
Ideally, have the possibility for each source to add custom url parameters for the profile_url.
Like today, we have the possibility to add custom scopes for each source.
Describe alternatives that you've considered
- Updating the Twitter provider to request the
confirmed_emailfield via the profile URL:https://api.twitter.com/2/users/me?user.fields=confirmed_email - To be able to fetch email, we need to update the OAuth scopes:
tweet.read users.read users.email. - Mapping the
confirmed_emailfield from the API response to theemailproperty in Authentik.
The idea is to populate the email field for Twitter/X users and ideally support custom fields in a consistent way across providers.
Additional context
- Facebook provider file:
"scope": ["email"],
...
profile_url = "https://graph.facebook.com/v7.0/me?fields=id,name,email"
- Twitter provider file:
"scope": ["users.read", "tweet.read"],
...
profile_url = "https://api.twitter.com/2/users/me"