When I switch Polylang to different languages - different domain, I am not able to run the Bricks editor and every time I got redirected to frontend version of the page.
We have dealt with this issue before in other tools too. The issue is that bricks runs on the frontend of the site and when you edit another polylang domain, it practically redirects to another site that you don’t have authentication cookies for.
To solve this, I wrote an automatic “loginer” on all domains defined in polylang (or manually configured via hook). When the user visits the admin dashboard (we only have this on the dashboard so it doesn’t run unnecessarily often), it triggers a javascript that logs the user to all other domains via wp ajax.
It’s a bit of a hackish solution, you have to modify CORS headers to do this and also set SameSite=None for auth cookies, which reduces security very slightly (to minimize risk, this login is only valid for 8 hours instead of the standard 14 days, but this can be easily changed in the code).
I’ve extracted the source code here:
We use a very similar solution also for logging between completely different sites. You just need to use a security key instead of WP security constants, which will be shared between sites, and modify the user ID selection.