Passport Google OAuth2.0 - How can I pass an object as a response after a successful authentication?

I GOT IT, FINALLY!!!

It's almost 4am here, then I got an insight "What if I try to set localStorage values directly from the Google callback, in such way that it hits the target URL with this data already set from the back-end?". So right after res.redirect(clientUrl + "/diary");, from the code above, I wrote:

window.localStorage.setItem("auth", JSON.stringify(true));

window.localStorage.setItem( "username", JSON.stringify(req.user.first_name) );

... and the magic happened.

That being said, I'm not sure if this is the correct approach to this issue, BUT it worked. Hopefully someone more experienced than me can tell if this is bad practice or not, as I don't want to get used to bad workarounds when there is a proper fix.

Anyway, thanks for your time and the willing to help =)

/r/node Thread Parent