I need to redirect a user after successful auth to its own sub-domain like
company.test.com
from test.com
The auth page opens on test.com
and when I get response for successful auth I get the user's sub-domain name from the database. So company name xyz
should redirect to xzy.test.com
, That part is already done.
The issue is the session of the user. I am saving the authenticated user data into redux and when pages refreshes/redirects to the subdomain it loses the user data.
All I can think of is that I should pass the authenticated user id
along with sub-domain like xyz.test.com/encrypted-user-id
to a route and I will get that user id on the back-end and will decrypt it and will force user login without asking for password again.
My question is that... is there an alternate way? If no, Is this a feasible way to solve this