Narendra Raghuwanshi Narendra Raghuwanshi - 4 months ago 16
PHP Question

why twitter not return email field using php after app white list

I will use twitter 0auth for login and my app white listed now I want to access client mail id but twitter not return any field (Email) so get this please suggest me any other change required after app white listed
then


  1. update privacy policy

  2. update terms and condition

  3. tick email access option

  4. regenerate apps secure key and id

  5. regenerate apps token access



and a option is also coming in authorize time (access email)

but email not coming

my code part is

$connection = new TwitterOAuth($this->consumer_key, $this->consumer_secret, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
$access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
unset($_SESSION['oauth_token']);
unset($_SESSION['oauth_token_secret']);
$connection = new TwitterOAuth($this->consumer_key, $this->consumer_secret, $access_token['oauth_token'], $access_token['oauth_token_secret']);
/* If method is set change API call made. Test is called by default. */
$content = $connection->get('account/verify_credentials',['include_email' => true]);
print_r($content);

Answer

Once you've authorized via OAuth, you then need to call the account/verify_credentials endpoint with the ?include_email=true option set.