I've only taken snippets of code from this repo for my project, but in
https://github.com/reactGo/reactGo/blob/master/server/db/sequelize/passport/google.js
for the Google OAuth2 strategy you can see there is a request object in the parameters:
export default (req, accessToken, refreshToken, profile, done) => {...}
I couldn't find where this was set or passed from. It must be somewhere in the middleware right? I was able to have access to the object after setting a passReqToCallback to be true here so it looks something like:
passport.use(new GoogleStrategy({
clientID: google.clientID,
clientSecret: google.clientSecret,
passReqToCallback: true,
callbackURL: google.callbackURL
}, handleGoogleUserInfo));
. Perhaps there can be some explanation on this in the docs or comments since this req object isn't talked about in the raw Passport setup instructions? Thanks.
Thank you. @gsccheng I also think it needs passReqToCallback: true. I'll make PR.
Thanks, also related here on lines 76-77
// TODO: accesstoken was null but req looked like one...?
return createUserWithToken(profile, req, done);
the reason why the req looked like the access token is because the access token was named as req as mentioned above without telling passport to send the req.
So this should go back to being:
return createUserWithToken(profile, accessToken, done);
I can also make a PR too if I have access. Thanks!
I can also make a PR too if I have access
I had assumed you could make a PR like normal in this repository (since it's been transferred). Is that not the case now?
Thanks, looks like it's taken care of now. I probably could have made the PR I just haven't tried it yet.
@gsccheng thank you for reporting. It is merged
Closing for now. But feel free to reopen if u find problems hehe
Most helpful comment
Thank you. @gsccheng I also think it needs passReqToCallback: true. I'll make PR.