Staying logged in, multiple domains

I want to remain logged in when going to a different subdomain.

This used to work by adding .domain1.app in my site security cookie options.
Then if I am on sub.domain1.app and switch to different.domain1.app it kept me logged in.

However I’ve recently added another domain, lets call it domain2.shop.

This is how I’ve got my cookie options set up (no idea if I can actually use a comma delimiter?)

Bump

We would be very interested in knowing how this works.
In a recent attempt, we had to make the domain and security provider name both same to get the cookie to work accross-sub-domain. It took way too much of trial and error to figure out.
Just setting the domain, as you have, should just work I think.

Cookies don’t support multiple domains, to make it work over multiple domains you should create a cookie for each domain or set the domain dynamically. We currently don’t support that.

1 Like

The global Security Provider options can be set per target, so you can set different cookie options depending on your current target within Wappler.

The purpose is to login in one app, and be treated as logged-in in another, since both might use the same DB/Login tables.

You cannot set cookies for other domains, allowing this would present an enormous security flaw. Also browsers block 3rd party cookies by default, so also using a hidden iframe will often not work.

  1. Keep Security Provider name same.
  2. primary domain name same (in cookie option)

This will ensure, cookie generated with same name for both domain, and since the database is same, it will be logged in another domain.

1 Like

@patrick As Sanjay has posted, this is what we did to make it work as @karh wants. In our two different Wappler apps, hosted under two sub-domains, but same primary domain.
So its sort-of supported by Wappler already.

1 Like

Thanks for the input everyone, I can live with this for now and know what to research further