My code is utilizing the onAuthStateChanged
function:
this.unregisterAuthObserver = firebase.auth().onAuthStateChanged(user => {
if (user) {
user.getIdToken(true).then((idToken) => {
console.log(user)
...
});
}
After the idToken
assigned to a logged-in user expires due to inactivity, what is the best course of action? Should I display a modal to inform the user that their session has ended, or simply reload the page using location.reload()
?
Furthermore, is there a way to retrieve the expiration time of the idToken
? The data from console.log(user)
does not provide this information.