How to get email from facebook through Guzzle in laravel?

前端 未结 2 1428
眼角桃花
眼角桃花 2020-12-21 09:17

I am using below code to login via facebook in laravel.

Referring https://scotch.io/tutorials/token-based-authentication-for-angularjs-and-laravel-apps for token ba

2条回答
  •  借酒劲吻你
    2020-12-21 09:58

    Use below code in your step 2.

    $fields = 'id,email,first_name,last_name,link,name';
    $profileResponse = $client->request('GET', 'https://graph.facebook.com/v2.5/me', [
    'query' => [
        'access_token' => $accessToken['access_token'],
        'fields' => $fields
    ]
    ]);
    

提交回复
热议问题