Python Forum

Full Version: Flask login help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a simple client app that accesses a flask web service to get data from a database and then write to a database. I make three calls to the web service: 2 to get data and populate the UI and 1 to write order info when the user completes an order. The web service is in the background and handles the data.
I want to add some basic security to the flask web service. My thought was to use flask-login to have the client pass user credentials when it connected and have the connection rejected if incorrect credentials are used. I was thinking very simple and doesn't have to be bulletproof.
I have read up on flask-login and I see examples on setting up authentication on the flask side, but I still have some questions. I am using requests to send the get and post requests from the client. I have URLs mapped in flask to resource classes to handle those requests. What I don't know is where I put the login stuff in flask since each get or post request maps to a different class. So if I pass credentials with the request from the client, how do I handle the verification of the credential and have the request map to the class that will process the request?