more and more modern browsers prevent cross-site tracking by default. For example, Safari, Firefox, Brave, they all use 'prevent cross-site tracking' as a default option. I analyzed our users and found out that 6% of them prevent cross-site tracking and have issues with authorization and refreshing tokens. But I'm sure that the percentage will grow. According to the news, Safari will keep preventing tracking by default.
Maybe, it's a good thing to do, but it breaks the majority of Single-sign on implementations.
THE CASE
Assuming, we have a big international service that has one domain for one country: site.com, site.ae, site.ru, site.ca, ...
. And we have SSO service on sso.site.com
that follows three rules:
- A user logs in the SSO domain once
- A user is authorized on all domains
- His session doesn't expire because we save him logged in as long as possible (until he signs out someday, of course).
SSO is awesome. It helps users. Users don't care about re-authorization. And it makes things easier for a company because there is only one authorization service. And you don't have to come up with another one for a new service.
How do modern SSO implementations (i.e. Auth0, stackauth e.t.c) achieve this?
They store tokens (access, refresh, JWT, doesn't matter) in cookies with the SSO domain sso.site.com
. When a user opens site.ae or site.ca
, for example, his user agent sends a request to the SSO, and the SSO checks his credentials stored in cookies, actualizes them (if necessary) and sends back the response, and then the app asks for user's data to another backend e.t.c.
THE PROBLEM
But it's not possible to do if user agents prevent cross-site cookies by default. Cause the SSO cookies won't be sent from another domain (i.e. site.ae
) except for site.com
since the SSO exists on sso.site.com
We may not use cookies in the near future. Yeah, we can use a chain of redirects though. Just imagine if you have hundreds of domains and ten milliseconds for each redirect! It slows the performance and user experience.
So my question is how can we login users and keep them authorized on many domains in the world when all browsers prevent cross-site tracking?