Open UshiHiraga opened 23 hours ago
Thanks for reporting @UshiHiraga. Do you know what we could do in Lumen to fix this issue?
I guess the problem is related with the way user's email is collected in the getUser()
method in netlify/edge-functions/github-auth.ts
According to response schema of /user/emails endpoint, it is possible to check visibility in the email object.
// Example presented in github api docs.
[
{
"email": "octocat@github.com",
"verified": true,
"primary": true,
"visibility": "public"
}
]
The solution would be to collect the first primary email that is also "public". It'd be necessary to changes lines 72 and 73 to:
const emails = (await emailResponse.json()) as Array<{ email: string; primary: boolean; visibility: string }>
const primaryEmail = emails.find((email) => email.primary && email.visibility === "public")
Sync fails. In developer's console appears:
Even if Lumen's repo is commonly used as a private repo, disabling "Keep my email addresses private" in Github is an undesired option for some people.