Closed rishabhpoddar closed 3 years ago
I'll look for a better place to fire this event, but a quick and easy solution seems to be to add a property to the event that would show if the current call removed the token. This way, both use cases would get the information necessary:
I don't quite understand the hacky solution. Perhaps elaborate a bit more:
It's not really hacky; it's more of a workaround.
Let's discuss this over a call. I am still unclear about what you are trying to say.
I propose calling this property sessionExpiredOrRevoked
, but we should make it explicit that this only happens in one tab (once per session). removingSession
would be more accurate, but it doesn't tell the user how to react to this event.
The cases we the "UNAUTHORISED" event is:
Cases 1&2 can occur many times, but 3 can only happen once per session, and as far as I can tell, this is the one we want to separate.
We could indicate something along the lines of hadSession
or triedRefreshing
, but that would not be too useful.
The code changes look good. Please do docs modification for the same.
@porcellus we also need to update the onHandleEvent type in the auth-react SDK as that doesn't have the extra boolean along with the UNAUTHORISED
action.
An instance of when we fire them is if after getting the refresh lock, and if the session doesn't exist, then we fire it. This may not be correct (see fetch.ts, line 357)