subdomain setup react

Job ID: 36270794

Budget: $10 – $30 USD

I need to set up dynamic domains in mern app.
I'm having some issues with cookies and the domain.
i need urgent assistance.
I am working on a MERN app that requires dynamic subdomains for each company (e.g. companyname.localhost).To achieve this.

When a user logs in at localhost:3000, cookies are created and the user is authenticated. If the user is registered with a specific company, they should be redirected to companyname.localhost while remaining logged in.However, upon redirecting to the subdomain, all cookies that were created on localhost are lost and the user is redirected to the login page again.

I expected the cookies to persist on the subdomain and enable the user to remain logged in. Can someone please assist me with this issue? Thank you.
Related categories: Node.js Express JS React.js MERN Stack