0

I am running a nodejs reactjs app on google clouds app engine. I am using a local passport authentication system.

On my localhost calling req.user in my server returns the users details. However when running my app on google cloud it returns undefined (I checked in the api's logs viewer). I'm guessing there must be a security reason for this (not 100% sure though), however I don't know what to do to address it. I have looked around and found google clouds Identity-Aware Proxy (IAP) - is this something I need to implement? Or am I barking up the wrong tree?

I am using the cookie-session, and passport packages.

app.use(cookieSession({
    maxAge: Infinity,
    keys: [process.env.SESSION_COOKIE_KEY],
    name: 'authCookie',
}));

app.use(passport.initialize());
app.use(passport.session());

EDIT: I have noticed that my session cookie is not being saved as a cookie in my deployed application (on google clouds app engine), however it is saved on my localhost app. And therein I assume lies the problem.

EDIT: I ended up using JWT (JSON web tokens) as my auth method. I think it's a better solution anyway. Which fixed (worked around) the issue.

Ben
  • 9
  • 1
  • 4

0 Answers0