logto icon indicating copy to clipboard operation
logto copied to clipboard

bug: GitHub connection does not fetch email-address

Open stephanvane opened this issue 2 years ago • 1 comments

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?

  1. Disable public email in GitHub settings (screenshot 1)
  2. Try to login, using the GitHub connection
  3. 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: Screenshot 2024-04-29 at 14 59 06

stephanvane avatar Apr 29 '24 13:04 stephanvane

We have an PR #5737 resolving the case you mentioned in this issue.

darcyYe avatar May 06 '24 02:05 darcyYe

Fixed, see referenced PR.

darcyYe avatar Jun 04 '24 02:06 darcyYe