Express session does not show session variables when called from React app but does from browser

Viewed 66

I have a simple endpoint where I am trying to check if a session variable is present and return a status(200) if so and return a status(401) if not.

Right now I am simply logging the req.session like so.

app.get("/api/checkAuth", (req, res) => {
    console.log(req.session)
}

When I fetch this endpoint from my React app (http://localhost:3000) the console.log(req.session) in my server does not show the values even though I know that I am signed in and the variables are present.

But if I go directly to the route in my browser http://localhost:4000/api/checkAuth then the console.log(req.session) successfully logs the session values.

My React application is not showing a CORS issue.

Any ideas on what is going on?

0 Answers
Related