I'm trying to get the private email of github user via passport-github.
So this is my code with scope: "user:email"
:
import passport from "passport";
import GithubStrategy from "passport-github";
passport.use(
new GithubStrategy(
{
clientID: process.env.GH_CLIENT_ID,
clientSecret: process.env.GH_CLIENT_SECRET,
callbackURL: `http://localhost:4000${routes.ghLoginCallback}`,
scope: "user:email",
},
async (accessToken, refreshToken, profile, cb) => {
console.log(profile.emails);
}
)
);
And now I get undefined
from profile.emails
.
I do get my profile
correctly, but with email:null
also.
Are there any possible problems that I'm missing?