There is no specific API to achieve what you want.
What you can do is the following:
- Issue access/session tokens with (relatively) short lifespans (like 1 minute)
- Have your frontend "continuously" refresh the tokens to keep the application signed in
In this way after a (relatively) small delay if the frontend is not running you end up with an expired session/access token and the user is effectively logged out.
Cons of this approach: if the user has a small window of connectivity problems their session will expire. If your system is a mobile application this might make your App very frustrating to use in various circumstances. Might not be a big problem if your use case is access from workstations.