我有一个项目,这个项目有一个登录页面,我使用护照 js google-ouath20。
我需要性别、出生日期信息,这就是我在 google 上添加新范围的原因
router.get(
"/login/google",
passport.authenticate("google", { scope: [ "https://www.googleapis.com/auth/user.gender.read", "https://www.googleapis.com/auth/user.birthday.read", "https://www.googleapis.com/auth/user.addresses.read", "profile", "email" ] })
);
但毕竟,当我尝试获取信息时,我只能访问个人资料和电子邮件信息。我错了其中的哪一部分?
passport.use(
new GoogleStrategy(
{
clientID: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
callbackURL: GOOGLE_CALLBACK_URL,
passReqToCallback: true,
},
async (req, accessToken, refreshToken, profile, cb) => {
console.log("profile: ",profile) ...