![Building Serverless Python Web Services with Zappa](https://wfqqreader-1252317822.image.myqcloud.com/cover/614/36699614/b_36699614.jpg)
上QQ阅读APP看书,第一时间看更新
Authentication
In order to develop an authentication module, we are going to use the Flask-Login extension. The Flask-Login extension provides a user session management mechanism. It handles the common tasks for managing user sessions such as logging in, logging out, and remembering the user.
To integrate Flask-Login, you need to create the instance and define some default parameters, as described in the following code snippet:
from flask_login import LoginManager
app = Flask(__name__)
login_manager = LoginManager()
login_manager.session_protection = 'strong'
login_manager.login_view = 'auth.login'
login_manager.login_message_category = "info"
login_manager.init_app(app)
We are going to create an authentication module as an auth package. An auth package will have basic scaffolding, as shown here:
![](https://epubservercos.yuewen.com/CACC6B/19470390501551006/epubprivate/OEBPS/Images/1a6dc22a-d9c4-4707-9ad0-82d64b5a8711.png?sign=1739144314-cJSSZUN0IEQokGBMpI2XUGXAMVo270dE-0-c72c0fd2f3e6e538c4b4c4061cabf385)