I have an app using Oauth2 (Azure) where the tokens expire quite quickly.
If the code discovers a token is expired/unusable for one reason or another, I want to force a logout.
There doesn’t seem to be a “nice” way to accomplish this, but I am far from a Panel expert so I’m hoping for some hints
I’ve fixed it by making an invisible ReactiveHTML component with a value trigger that does window.location = '/logout' (as well as a trigger if value > 0 on render to catch if it was expired before the app was served) and it works decently, but it feels somewhat hackish.
Another idea I threw around was having a reactivehtml component delete the cookies, then reload the page, but that’s not really particularly better.
I basically just add it to the template’s header container. Then call logout when I need to logout.
It does it both on value change and on after_layout to ensure it’ll work if it’s logout was called before the component was renderered (which in the design of this app can happen easily.)
I’m not convinced this is a particularly great solution, but I needed to move on to do actual work
I unfortunately can’t share the actual solution for the OAuth2 issues. I ended up creating a custom oauth-provider for panel which does a bunch of magic to make things work.