Continued from: Cloudflare cookie: CF_Authorization
We are utilizing Microsoft SSO for login, integrated with OpenID Connect. When users click the forum link, they are redirected to the Microsoft login system, thus no login button is displayed on the forum.
We also use Cloudflare on top of the forum, which includes cookie sessions.
We encounter two issues:
-
Wen the Discourse
_t
cookie session expires, users are redirected to an error page.
-
When the Cloudflare authorization cookie session expires, users are redirected to an error page.
Both scenarios redirect users to domain_url/exception
.
My goal is to automatically reload the forum when these situations occur. This would ensure users are either redirected to the Microsoft login or the cookies are updated based on SSO.
If anyone has alternative solutions, please share.
I tried the following script:
<script>
window.addEventListener('error', function (event) {
window.open(url, '_self');
}, true);
</script>
While it works, it is not smooth as the user can see the error page and it takes a while to reload the page.
Please share any other ideas or improvements for a more seamless user experience.