Hey! :wave: I have a question about implementing ...
# talk-kratos
m
Hey! 👋 I have a question about implementing Ory for my company’s micro-frontend. Ideally, we’d like them to be decoupled. One doesn’t pass auth state to the other which would couple them. We don’t really want to poll toSession or cookies. Ideally, I think we’d need a websocket or similar on which we can use to listen for auth changes on Ory… The alternatives feel a bit hacky
@magnificent-energy-493 @fast-lunch-54279 @proud-plumber-24205 just tagging you guys in case you missed this message. The company I work for is Prodigy Finance. Any thoughts and assistance would be really appreciated 🙏
f
so you want the frontend to get a push message when the session expires or is terminated? there's no such thing out-of-the-box as far as i am aware, so you'd have to build it, potentially by using session TTLs and webhooks listening to logout events
m
@important-area-42405 For your visibility
@fast-lunch-54279 thanks for the response! We’d prefer to have a web socket connection but I guess a push message could work
Is there possibly another way your team would recommend that we architect our frontend solution that is decoupled but still reactive in real time to auth changes?
If we have multiple tabs open of our website open. One tab authenticates how will the other show that they are authenticated if toSession is only run when the page initially loads? @fast-lunch-54279 The same goes for logout
I guess what I’m asking is how do pages remain in sync without each of them polling cookies or toSession
f
m
Oh this is an interesting idea! Thanks Klaus! We’ll look into it
@fast-lunch-54279 Just read that Safari doesn’t support this. A significant percentage of our users are on safari/safari mobile 😕 Given this, I don’t think this isn’t the complete solution we’re looking for
The link you shared was to the Extensions docs. Given we’re working with a website we’d need to use this. It seems this API is supported even less (both Firefox & Safari don’t)
What do you think about leveraging Broadcast Channels? Perhaps Ory could wrap this api so that there’s a messaging standard that all webpages adhere to. If one page signs in or out all will know to call
toSession
or something?
f
Ah interesting. I think that’s be cool feature - however it’s not currently on our roadmap as this hasn’t been requested before. Would you be open to contribute it to Kratos?
m
Yeah sure I’d be happy to but I think it would be wise to chat through the idea with someone from you side before jumping into implementing it. Would it be possible to setup a call?