def get_auth_token(self):
"""Cookie info. Must be secure."""
s = Serializer(current_app.config["SECRET_KEY"],
current_app.config["COOKIE_EXPIRATION"])
current_app.logger.debug("Generating auth token for user %s" % self.id)
if not self.is_authenticated:
raise Exception("User not authenticated")
return s.dumps({
"user_id":
self.id,
"session_id":
SessionCache.create_session(
self.id, expiration=current_app.config["COOKIE_EXPIRATION"])
})
评论列表
文章目录