If you have two or more instances on the same domain, you are able to be logged in only in 1 instance at the same time.
The problem is when the user is logged in via third party authentication. The jwtToken is saved in Cookies and then it is moved from cookies to the localStorage.
The Strapi does not work with path or domain attribute when sending the jwtToken via ctx to the client:
const redirectWithAuth = ctx => {
// ....................
const cookiesOptions = { httpOnly: false, secure: isProduction, overwrite: true };
// ................
ctx.cookies.set('jwtToken', jwt, cookiesOptions);
// ............
};
and when I rewrite a cookies path via Nginx, it does not help me, because the localStorage is shared for all instances.
Created by Derrick Mehaffy
February 2, 2023