Custom Domains in react

I have a react app that has a regular url: example.com and when on mobile the url changes to mobile.example.com.

My issue is that when logged in to the regular desktop url its fine. When I resize the browser on the same device it redirects to the mobile.example.com url and logins in with a different user that last logged into the mobile site. Is there a way to use the same auth in both desktop and mobile site?