Heyyo, this issue is driving me nuts.
I have an issue where Passport.Js seems to not be getting a user session sent back from the user. Everything else seems to work fine, and there is no problem serializing or deserializing the user.
When deployed, it seems to work fine on Firefox, but not on Chrome. It works on Chrome when I am testing on my local machine using http://localhost:PORT, but just not when deployed.
Because it works fine on my local machine, I was wondering if it might be an https/http issue?
Does anyone have any idea what the issue could be? Thank you.
Middleware:
app.use(cookieParser());
app.use(expressSession({
resave: true,
saveUninitialized: true,
secret: process.env.REACT_APP_SESSION_SECRET,
}))
app.use(passport.initialize());
app.use(passport.session())
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cors({
origin: "https://example.url",
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
credentials: true,
}));
app.use(express.static('public'));
Example of request to server:
fetch(`https:example.url/sync/`, { credentials: 'include'})
.then({ // ... })
Thanks in advance.