Is there a suggested way to keep web3auth session among multiple subdomains?

My company website is composed of three different subdomains.
And I found that web3auth session is not kept among them.
Perhaps that's because it uses localStorage.
But is there a recommended way to solve this issue?



Originally posted by: jisoo-3pm

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/569
  • There is a way to achieve this by syncing local storage across your sub-domains but you have to implement it on your end:-
    a. Keep the same web3auth clientId in all domains.
    b. Deploy a new subdomain for ex: auth.yourdomain.com
    c. Use auth.yourdomain.com as an iframe in your other subdomains and sync local storage data from your application subdomain to auth.yourdomain.com using window post messages between iframe and parent. This way you can keep local storage synced between all your subdomains

    < = > : Two way channel b/w iframe and parent
    Subdomain A <=> Auth Domain (iframe) < = > Subdomain B



Originally posted by: himanshuchawla009

Hello! I have the same use case. I would like to share a session between two subdomains. I am currently using PnP no-modal sdk. I can’t find any information on how to initialize the sdk with a previously created session on another subdomain. I tried copying the session data from localstorage and putting it on another domain, but it throws an error about an expired or invalid session. Could you please explain me how to do this? Thanks!

Hey @alexey.moiseenko
Can you please share the code showing how you’re trying to implement this? I’ll be able to help you better.