How do I tell if I'm logged in?

I have got a React App with Seamless SSO set up through the Directus SDK. I can log in, log out, and grab my profile.

what’s the general way to track if I’m logged in or not? especially when the user closes the browser and comes back the next day?

I’ve previously used Firebase for authentication and there was a callback I could register: onAuthStateChanged. this ran automatically when the app loaded and allowed me to distinguish between logged in, logged out, and unknown states.

is there something similar with the Directus SDK?

The most reliable way of checking whether someone is logged in is to do an authenticated request for example getting the current user GET /users/me or like the directus app attempt to /auth/refresh on loading. In certain cases you can check if the access token exists but that will not tell you if the token is still valid.