passport.js

How to read the cookie on the client side (react) that was set via Passport on the Server side (node-express)?

眉间皱痕 提交于 2020-08-26 13:33:13
问题 How to read the cookie on the client side (react) that was set via Passport on the Server side (node-express)? The cookie is setup correctly and can be serialized and deserialized on the server side as shown in the below code: passport.serializeUser(function(user, done) { done(null, user.id); }); passport.deserializeUser(function(id, done) { User.findById(id, function(err, user) { done(err, user); }); }); How can I read this cookie on the client side (React)? I don't have much experience with

How to read the cookie on the client side (react) that was set via Passport on the Server side (node-express)?

吃可爱长大的小学妹 提交于 2020-08-26 13:32:21
问题 How to read the cookie on the client side (react) that was set via Passport on the Server side (node-express)? The cookie is setup correctly and can be serialized and deserialized on the server side as shown in the below code: passport.serializeUser(function(user, done) { done(null, user.id); }); passport.deserializeUser(function(id, done) { User.findById(id, function(err, user) { done(err, user); }); }); How can I read this cookie on the client side (React)? I don't have much experience with

Restrict login to specific domain using Node Passport with Google Auth

可紊 提交于 2020-08-20 20:58:13
问题 I am implementing Google Auth on an internal service at work. It is a JS client heavy application with a Node backend. I am choosing to use the Node module Passport.js with the passport-google-oauth strategy. I have successfully got it working but one thing is still confusing me. I want to ensure my application allows only company employees to login. I understand that you can restrict the login by domain using a parameter called "hd", according to the official documentation. Firstly, where do