skip to Main Content

I am using the generated access_token to etch user details for implementing Twitter Login in PHP website. i am getting id,username and name in response of the https://api.twitter.com/2/users/me api. But it does not return the email address of the user.

Can anyone help in letting me know how to get email in this Twitter API response, or, even from any other Twitter API

I have enabled/done the following in my App settings:

  • Checked/Set the option “Request email from users” in User Authentication Settings > App permissions
  • As required, I have also entered the App’s Privacy Policy URL and Terms of User URL.
  • Scope used: tweet.read users.read follows.read follows.write offline.access
    Still I am unable to get email address in response.

2

Answers


  1. Twitter doesn’t give user email in API V2.

    Here is table what you can get from /2/users/me:
    https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user

    Login or Signup to reply.
  2. You can get authenticated user’s email by v1 API account/verify_credentials
    with include_email=true.
    Most v1 APIs are deprecated but this is still available. And you can use this until v2 alternative comes up.
    See https://developer.twitter.com/en/docs/twitter-api/v1/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials for the details.

    To get user’s email, you should turn on Projects & Apps > Your App > Settings tab > User authentication settings > Request email from users option on Twitter Developer Portal.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search