netlify / gotrue

An SWT based API for managing users and issuing SWT tokens.
https://www.gotrueapi.org
MIT License
3.84k stars 285 forks source link

Bug: When using GitHub as an external provider only the primary email is taken into account #242

Closed erezrokah closed 4 years ago

erezrokah commented 4 years ago

- Do you want to request a feature or report a bug? Bug, see https://github.com/netlify/netlify-cms/issues/3587#issuecomment-612983670 for context

- What is the current behavior?

Trying to login via GitHub with an invited but non primary email fails.

- If the current behavior is a bug, please provide the steps to reproduce.

  1. Setup a GitHub account with a primary email and another email.
  2. Setup a Netlify site with Identity + Invite Only + GitHub external provider.
  3. Invite the non primary email.
  4. Try to login via the non primary email and see that it fails.

- What is the expected behavior?

Trying to login via GitHub with an invited but non primary email should succeed.

- Relevant code https://github.com/netlify/gotrue/blob/c9327d42aacc622c9dac493c8126f01f15ffc44d/api/provider/github.go#L86

erezrokah commented 4 years ago

Update: relevant for Bitbucket too. For GitLab looks like the first additional email is taken if exists, otherwise the primary email is used.