Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

@natanbr yes, here what I'm currently doing: #18

@iamgkstack

Description

@iamgkstack

@natanbr yes, here what I'm currently doing:

const passportGoogle = require('passport-google-oauth').OAuth2Strategy;

const computeConnectedUser = strategy => (req, accessToken, refreshToken, profile, done) => done(false, { strategy, accessToken, refreshToken, ...profile });

const googleStrategy = new passportGoogle({
    clientID: googleConfig.clientID,
    clientSecret: googleConfig.clientSecret,
    callbackURL: googleConfig.callbackURL,
    profileFields: googleConfig.profileFields,
    passReqToCallback: true,
}, computeConnectedUser('google'));

passport.use(googleStrategy);

router.all(googleConfig.connectURL, passport.authenticate('google', { authType: 'rerequest', accessType: 'offline', prompt: 'consent', includeGrantedScopes: true, scope: googleConfig.scope }));

router.all(googleConfig.callbackURL, passport.authenticate('google', { failureRedirect: googleConfig.connectURL, session: false }), oauthed);

Originally posted by @damianobarbati in #5 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions