# How to check if user session is active from Express API?

**URL:** <https://community.auth0.com/t/how-to-check-if-user-session-is-active-from-express-api/60262>\
**Category:** Get Help\
**Tags:** checksession, api, login, auth0\
**Created:** [March 29, 2021, 5:49pm UTC](https://community.auth0.com/t/how-to-check-if-user-session-is-active-from-express-api/60262 "2021-03-29T17:49:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashish.yadav](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ashish.yadav/32/14581_2.png) [@ashish.yadav](https://community.auth0.com/u/ashish.yadav)\
**Post date:** [March 29, 2021, 5:49pm UTC](https://community.auth0.com/t/how-to-check-if-user-session-is-active-from-express-api/60262/1 "2021-03-29T17:49:01Z")

</div>

Hi,

How can I check if the user is currently active from the backend(Express)?

Use case:  
The express server has a cron job that checks if the user session is active and runs some method.

Options:  
The simplest option is probably to push logged-in timestamp to the database in intervals using an API from the react app and express cron check the database timestamp. If the timestamp is in the ballpark of the current time, it executes the method.

However, I believe there could be a better way.  
Like when the express cron executes, it can somehow get the users with currently active sessions/logged-in users and performs the desired function.

Any tips or recommendations?  
Thanks!

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [January 31, 2025, 6:16pm UTC](https://community.auth0.com/t/how-to-check-if-user-session-is-active-from-express-api/60262/2 "2025-01-31T18:16:20Z")

</div>

Hi there!

Welcome to the Auth0 Community!

To validate session from the back-channel, our recommended way is to use the `GET /api/v2/sessions/{sessionId}`[Manage User Sessions with Auth0 Management API](https://auth0.com/docs/manage-users/sessions/manage-user-sessions-with-auth0-management-api#user-resource).

Alternatively, you might find our OIDC Back-Channel Logout feature interesting since it allows your backend to subscribe to logout events. → [OIDC Back-Channel Logout](https://auth0.com/docs/authenticate/login/logout/back-channel-logout)

Thanks  
Dawid

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 14, 2025, 6:16pm UTC](https://community.auth0.com/t/how-to-check-if-user-session-is-active-from-express-api/60262/3 "2025-02-14T18:16:57Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
