Retrieving google groups after authenticating user in node.js oauth passport applicaton: 403 Not Authorized to access this resource/api

I’m using google passport in a node.js application, and upon successful authentication, trying to use the access_token to retrieve the google groups that the current user is a part of (I just want to check if they’re part of a specific group). I’ve enabled the Admin SDK for the client in the Google Developer Console.

passport.use(new GoogleStrategy({     clientID: process.env.GOOGLE_CLIENT_ID,     clientSecret: process.env.GOOGLE_CLIENT_SECRET,     callbackURL: `/auth/google/callback`   },   (accessToken, refreshToken, profile, done) => {     // find or create our local user here, if necessary     // console.log(profile)      const oauth2client = new google.auth.OAuth2();     oauth2client.setCredentials({         access_token: accessToken     });           const directory = google.admin({ version: "directory_v1", auth: oauth2client });      directory.groups       .list({ domain: "" })       .then(groups => {         console.log(groups)       })       .catch(console.error);          done(null, profile)   } )) 

I receive the following 403 error:

Not Authorized to access this resource/api 

here are my scopes:

'',  '', '', '', '' 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.