How to get email address when user is authenticated with Google Oauth2 and people.me

前端 未结 1 1140
无人共我
无人共我 2020-12-21 17:26

I\'m new to php and the google api, I\'m trying to get the email address when the user sing in with Google+, I get all the User info using $plus->people->get(\"me\") but whe

相关标签:
1条回答
  • 2020-12-21 18:01

    $me['emails'] is an Array, not a Hash. So add an [0] for choosing the first Mailadress:

    $correo = ($me['emails'][0]['value']);
    

    Now it should work fine...

    0 讨论(0)
提交回复
热议问题