Search code examples
passport.jsgoogle-plus-signinpassport-google-oauth

How to get friend list from Google Plus by using Passport


I can get Facebook friends list with Passport:

new FacebookStrategy({
        // pull in our app id and secret from our auth.js file
        clientID        : config.facebook.clientID,
        clientSecret    : config.facebook.clientSecret,
        callbackURL     : config.facebook.callbackURL,
        profileFields   : ["id", "birthday", "email", "first_name", "friends", "last_name"]
    }

I am curious whether there is a way for Google Plus in the similar fashion?

new GoogleplusStrategy({
        clientID     : configAuth.googleAuth.clientID,
        clientSecret  : configAuth.googleAuth.clientSecret,
        callbackURL     : configAuth.googleAuth.callbackURL
    }

I am using "passport-google-oauth" module for the strategy.

Thanks

Derek


Solution

  • An indirect way is :

    GET www.googleapis.com/plus/v1/people/userid/people/connected?access_token=accessToken
    

    Using querystring or https can do the work.