简体   繁体   English

身份验证有效期和一次登录

[英]Authentication expiry dates and single login at a time

I work on an angular web-app with a nodeJS backend. 我在一个带有nodeJS后端的有角度的Web应用程序上工作。 I want to implement the two following features: 我要实现以下两个功能:

  1. User expiry dates: I want to be able to grand each user a period of time in which he can use my app (a trial-period). 用户有效期:我希望能够给每个用户一个可以使用我的应用程序的时间(试用期)。 After this period of time has expired, the user will be logged-out and will not be able to log-in again. 在这段时间过后,用户将被注销,并且将无法再次登录。

  2. Single user at a time: I want each user to be logged just once. 一次只有一个用户:我希望每个用户只被登录一次。 If a user will log-in on a second device, his first device will be logged-out. 如果用户将在第二台设备上登录,则其第一台设备将被注销。

Can you please advice how can I achieve such functionality? 您能建议我如何实现这种功能吗? Should I use anything like Firebase to help me? 我应该使用Firebase之类的东西来帮助我吗?

  1. You can use req.session.cookie.expires after installing the express-session package to handle the time of authentication 您可以在安装express-session软件包后使用req.session.cookie.expires处理身份验证时间

https://github.com/expressjs/session or https://github.com/expressjs/cookie-session https://github.com/expressjs/sessionhttps://github.com/expressjs/cookie-session

  1. check this: 检查一下:

Only allow signing in from one device at a time in NodeJS 仅允许一次在NodeJS中从一台设备登录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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