Search code examples
yii2twitter-oauth

Get user's email from twitter login in yii2


I could successfully get email of the user while logging in with google, facebook, and vkontakte. Twitter by default doesno allow getting an email of the user. After a request I got this permission and in my Twitter apps I have Request email addresses from users as checked.

But in the result array I get a lot of data with twits, username, timezone, etc. except the email. What can be the problem?


Solution

  • It was not yet implemented in Yii2. It is going to be probably added very soon. Now it is not possible to send twitter params with default configuration

    It is
    return $this->api('account/verify_credentials.json', 'GET');
    inside the AuthClient,

    but it must be
    return $this->api('account/verify_credentials.json', 'GET', ['include_email' => 'true']);