Google Api get users Email Address

后端 未结 2 887
不知归路
不知归路 2021-01-24 08:39

I am using the Google Api PHP client to Log the user in. I want to get the Users Email address. I have the following code.

Scope:

$client->setScopes(\         


        
2条回答
  •  既然无缘
    2021-01-24 09:01

    Setting the scope in an array does the job.

    $this->client->setScopes(array('https://www.googleapis.com/auth/analytics.readonly', 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile'));
    

提交回复
热议问题