I see two different ways to do this:
- Track the time to live of the session cookie on the client. The default TTL of a session cookie is 24 hours. However, the session cookie may have been deleted on the server side (if the user logs out on another device for example). So that’s perhaps not the best approach.
- Monitor the replication change event for a
401 Unauthorized
error which means that the cookie has expired. In this case you can request a new session cookie from your app server. Ideally at this point the user shouldn’t have to login again but I don’t know how this can be done with 3rd party auth providers.
Are you using session cookies in the context of user authentication with a 3rd party provider? Can you provide a bit more detail about the login flow you wish to implement?
James