Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Github not returning user email #5599

Closed
msbeeman opened this issue Oct 19, 2022 · 0 comments
Closed

Github not returning user email #5599

msbeeman opened this issue Oct 19, 2022 · 0 comments
Labels
providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@msbeeman
Copy link

msbeeman commented Oct 19, 2022

Provider type

GitHub

Environment

System:
OS: macOS 12.6
CPU: (8) arm64 Apple M1
Memory: 1.01 GB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.1 - /usr/local/bin/node
npm: 8.15.0 - /usr/local/bin/npm
Browsers:
Chrome: 106.0.5249.119
Safari: 15.6.1
npmPackages:
next: latest => 12.3.1
next-auth: ^4.14.0 => 4.14.0
react: 18.1.0 => 18.1.0

Reproduction URL

https://next-auth.js.org/tutorials/creating-a-database-adapter

Describe the issue

Per the GitHub provider documentation, where the tip at the bottom of the page states:

Email address is always returned, even if the user doesn't have a public email address on their profile.

I would have expected the user object GitHub returns to have the email. However, GitHub is passing me back a user object only with a valid name and image, but an undefined email value and a null emailVerified value.

`{
name: 'John Doe',
email: undefined,
image: 'https://avatars.githubusercontent.com/u/______',
emailVerified: null
}

How to reproduce

  1. 1st Image: Create a simple app with the GitHub provider
  2. 2nd Image: Fill in the adapter createUser() function with a simple console.log(user)
  3. 3rd Image: Look at the user object getting returned from GitHub.

[...nextauth].js file where GitHub provider is added:
image

Custom adapter createUser() function:
image

Object returned from GitHub in the createUser() function:
image

Expected behavior

User object returned by github containing an email as stated in the documentation.

@msbeeman msbeeman added providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

1 participant