Hi, I'm working on integrating an Express app wit...
# support-questions-legacy
e
Hi, I'm working on integrating an Express app with authentication cookies set by a different subdomain. Our user authentication happens at dashboard.domain.nl, and I need to use these authentication cookies on server.lokalist.nl. Here's our backend configuration for the domain where users log in:
Copy code
js
Session.init({
  cookieDomain: process.env.NODE_ENV === 'production' ? '.lokalist.nl' : 'localhost',
  cookieSameSite: process.env.NODE_ENV === 'development' ? 'strict' : 'none',
});
And this is our frontend configuration:
Copy code
js
Session.init({
  sessionTokenBackendDomain: process.env.NODE_ENV === 'production' ? '.lokalist.nl' : 'localhost',
});
In our Express app, we want to leverage these session cookies. Below is the middleware function we use for session authentication:
Copy code
js
const sessionAuthentication = (req: Request, res: Response, next) => {
  try {
    verifySession({
      sessionRequired: true,
    })(req, res, next);
  } catch (e) {
    console.log(e);
    throw new StandardError('UNAUTHORIZED', 'Unauthorized', e, {});
  }
};
I previously consulted with SuperTokens support, and they mentioned we were using header-based authentication. However, this is only the case for our mobile apps, not for the web application in question. Could you advise on how to properly use the cookies set by dashboard.domain.nl for authorizing requests on server.lokalist.nl?
6 Views