User management on two projects

Hello, I’m relatively new to weweb. I want to create one app subdomain and one www subdomain for the landing page. For this purpose, I will create two projects. Is it possible to displaying different content on the landing page if the user has logged in on the app? I am using Xano auth. In other words, would the cookie from one be valid in the others? Thanks

Do you mean you will have a weweb app on app.mydomain.com and another weweb app on www.mydomain.com ?

Yes, that’s correct. But… I guess it’s not possible?

To be honest I’m not sure about the current behavior :thinking:

  • The cookie we create is probably set on the sub domain, so it won’t be shared across subdomain
  • This cookie is expected to be removed in the coming weeks as we will rework how we handle authentication
  • I thought about using localstorage but it seems it cannot be shared easily across subdomains

I think you have two options here

  1. Create yourself a cookie with javascript when your user login containing the token (cookies.set), and apply your root domain in the cookie settings so it can be read by every subdomains, you should be able to read the cookie when available and set the token manually through the plugin action
  2. More secure but more technical, if you want a cookie that is “http only” and “secure”, you will need the new option we plan to release, this options allow you to send cookies automatically with your requests, its useful for cookies created by the server (set-cookie header), you will create this cookie on your login endpoint and so it will automatically be sent with all request from the browser to your Xano
1 Like

Thank you for the answer, option 2 makes sense and can solve the issue.

1 Like