Closed Yoann-TYT closed 1 year ago
We can simply avoid this issue by fetching emails in our authenticator.
$githubUser = $client->fetchUserFromToken($accessToken)->toArray();
$emails = $this->client->request(
'GET',
'https://api.github.com/user/emails',
['auth_bearer' => $accessToken->getToken()]
)->toArray();
$githubUser['email'] =
array_values(
array_filter($emails, fn ($email) => true === $email['primary'])
)[0]['email'];
Fixed by #20.
Hi everybody :)
I found a bug. If we add
user:email
scop, we get null for email attribute.I checked on HWIOAuthBundle, and email is fetched using /user/emails endpoint.
I don't know how to fix this issue because the request is done in "oauth-client".
https://github.com/hwi/HWIOAuthBundle/blob/3dfd2c80835b8c3fe0d1dd666bc1bff6391017bc/src/OAuth/ResourceOwner/GitHubResourceOwner.php#L48
Thanks !