My question is simple, is there a "good" and applicable way to check when a bearer token is expired from my Angular app?
This is my problem:
If I leave the app open in my browser... someone could see what is on my screen (because i am still "tecnically" logged in). Whereas if i implement a log out when token is expired that would not happen.
Here's what i would want:
I do NOT want to check the token when i do API's calls (since i'am already doing that).
What i want is to let the angular app "automatically" know when the token is expired.
Here's what i've tried:
I tried to create a function that is called every five seconds to check for bearer token expiration but i think this is not a doable solution and will result in performance issues and unclean code.
What i also did was create an Angular interceptor and intercept any 403 / 401 API's calls but that only solves my problem slightly.
I am already checking token validity on back-end when an api call is made
I scattered online for solutions, and my understanding is that there isn't a "clean" one right now.
Any help here would be apreciated!