jaredhanson / passport-google-oauth2

Google authentication strategy for Passport and Node.js.
https://www.passportjs.org/packages/passport-google-oauth20/?utm_source=github&utm_medium=referral&utm_campaign=passport-google-oauth20&utm_content=about
MIT License
812 stars 154 forks source link

Youtube Scope Doesnt Work #84

Closed gaurishhs closed 11 months ago

gaurishhs commented 2 years ago

Hello, I Had the youtube.readonly scope on still if i console log profile, i dont get user's youtube details.

Expected behavior

Profile should have returned youtube username and url

Actual behavior

profile object didnt have any yt info

Steps to reproduce

passport.use(new GoogleStrategy({
    clientID: config.YoutubeClientID,
    clientSecret: config.YoutubeClientSecret,
    callbackURL: config.YoutubeCallBackURL,
    passReqToCallback: true
},
    function (request, accessToken, refreshToken, profile, done) {
        console.log(profile)
    }
));

app.get('/auth/google',
  passport.authenticate('google', { scope:
      [ 'email', 'profile', 'https://www.googleapis.com/auth/youtube.readonly' ] }
));

app.get( '/auth/google/callback',
    passport.authenticate( 'google', {
        successRedirect: '/auth/google/success',
        failureRedirect: '/auth/google/failure'
}));

Environment