How is the req object passed to Google callback?
See original GitHub issueI’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.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Passport JS Google oauth20 callback missing req object
I have seen some similar questions here but the answer is irrelevant to mine, as I have declared passReqToCallback.
Read more >Add and delete callbacks | Generic pass - Google Developers
For every add or delete performed by the user on an object, Google makes callbacks to the merchants with details about the add...
Read more >HTTPS | Node.js v19.3.0 Documentation
https.request(url[, options][, callback]) # ; v10.9.0. The url parameter can now be passed along with a separate options object. ; v9.3.0. The options...
Read more >5.x API - Express.js
A new body object containing the parsed data is populated on the request object after the middleware ... The parent app is passed...
Read more >10. Node.js: HTTP, HTTPS - Books at mixu.net
The first parameter of the request handler callback is a ServerRequest object. ServerRequests are Readable Streams, so we can bind to the "data"...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you. @gsccheng I also think it needs passReqToCallback: true. I’ll make PR.
@gsccheng thank you for reporting. It is merged