For my project, I've implemented Firebase as a simple backend solution. However, I've encountered an issue where Firebase expires my token after a short period of time. My goal is to detect this specific error and prompt the user to log in again.
The challenge lies in the fact that Firebase returns a unique object for error responses, and I need to access the error message property "Auth token is expired." I attempted the following approach, but it did not yield the desired result:
this.dataService.sendData(data)
.subscribe(
(response) => console.log(response),
(error) => {
if(error._body.error == "Auth token is expired"){
//handle user re-login logic
}
}
);