如何延长 Meteor 登录令牌的生命周期



我有一个流星应用程序,似乎在 24 小时后强制注销。我们的应用程序(测试版)正在使用"访客登录"过程,我们在其中动态创建帐户,因此我希望实际上拥有无限期的令牌生命周期。有没有办法延长这些代币的生命周期?

Error logging in with token: Error: You've been logged out by the server. Please log in again. [403]
update failed: Access denied

我们的访客登录如下所示:

postCreateUser = (username, password) ->
  dclib.clog("login", "created", username)
  Meteor.loginWithPassword username, password, ->
    # FIXME? could this be in onCreateUser server side?
    Meteor.call "createPersonalRoomIfNone"

if Meteor.isClient
  Meteor.startup ->
    unless Meteor.userId()
      Meteor.call "getLastUserIndex", (err,index)->
        if err
          throw err
        console.log("creating guest user", index)
        username = "Guest #{index}"
        password = Random.id()
        Accounts.createUser
          username: username
          email: ""
          password: password
          role: "guest"
        , -> postCreateUser(username, password)
我希望

这样做!

# prevent users getting logged out
# http://devdocs.io/meteor/index#accounts_config
Accounts.config ({loginExpirationInDays: null})

最新更新