Twitter REST API hitherto did not include users email address by default when the /verify_credentials endpoint is requested, unless your application had been explicitly whitelisted after filling the special permissions part of this form.
Now you can get user’s email addresses included in the API response by ensuring you have links to your privacy policy and terms of service saved in your application settings.
Then navigate to the permission tab, check the Request email addresses from users
and save.
With the above ritual done; to get user’s email address, append a include_email
GET parameter with value “true” to the endpoint like so: /verify_credentials?include_email=true
If you use HybridAuth PHP library like we do over at ProfilePress, adding 'includeEmail' => true
to your twitter array configuration will automatically do the appending of ?include_email=true
during API calls.
"Twitter" => array(
"enabled" => true,
"keys" => array(
"key" => $db_settings_data['twitter_consumer_key'],
"secret" => $db_settings_data['twitter_consumer_secret'],
),
'includeEmail' => true,
),
La Fin!