bug: GitHub connection does not fetch email-address
Describe the bug
When using the GitHub connector, a new account will be created without an email address (unless the user has a public email address on their GitHub profile)
Expected behavior
I would expect Logto, to fetch the email-address from GitHub, in addition to the avatar / fulll-name etc.
This van be solved by doing 2 calls. One call to https://api.github.com/user to fetch basic information. and one extra call to https://api.github.com/user/emails fetch the primary email-address.
This call returns something like this:
[
{
"email": "***@***.***",
"primary": true,
"verified": true,
"visibility": "public"
}
]
Next-auth uses the same approach, please look at this code for inspiration.
Please let me know if I can help out. I'm a little limited in time, but I think this problem is breaking quite some integrations.
How to reproduce?
- Disable public email in GitHub settings (screenshot 1)
- Try to login, using the GitHub connection
- View the new user in the admin-dashboard. The Name/avatar etc. have been filled in, but the email-field is empty.
Context
- [ ] Logto Cloud
- [x] Self-hosted, Logto version =
docker.io/svhd/logto@sha256:9c1757cced89be7ba8052c289728a33e742ae7e069e8da8ae2e015a400b7afba - [ ] Container (Docker image)
- [ ] Raw Node.js
Screenshots
1:
We have an PR #5737 resolving the case you mentioned in this issue.
Fixed, see referenced PR.