简体   繁体   中英

How do I set up a login session timeout in Meteor.js?

(I'm asking questions using a translator.)

I'm not storing user information in the users collection, but in a separate collection I've created.

If the user does nothing for 10 minutes after logging in, I want to log out automatically.

The session API provided by Meteor seems to be available only to clients.

Is there any other way?

How about use stale-session ?

Stale session and session timeout handling for meteorjs.

meteor add zuuk:stale-session
  • The user will be logged off whether the browser window remains open or not.
  • The user is logged off by the server and disabling javascript in the browser (kind of pointless in meteor.) would not prevent automatic log off.
  • The user can be logged on multiple times on multiple devices and activity in any one of those devices will keep the sessions alive.
  • The plugin uses a heartbeat that is configurable but defaulted to ensure that the server is not inundated with heartbeats from clients in systems with many concurrent users.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM