I am trying to come up with a nice way of allowing a "non-interactive" authentication for access to certain views in my Flask webapp, which currently makes use of flask-login.
At the moment, users authenticate using a web form. Credentials are then checked, and if there's a match, I call flask_login.login_user(user), where user is the user object associated with the provided username and password. I then decorate any view that requires an authenticated user with the @flask_login.login_required decorator. This works well.
I now have the need to allow access to some specific pages using a headless browser, for PDF generation. What is the best approach for accomplishing this? I'm thinking either HTTP Digest Auth or token-based (supplied through the view through a GET parameter, perhaps?), but am not sure of the best way of going about this, and how it will fit in with flask-login.
Ultimately, I'll need to call flask_login.login_user(user) (where user is the system user associated with the provided token/digest credentials) somehow, but bypassing the normal redirect back to the login page in cases where alternative credentials have been supplied. Should I be writing a new decorator (like @token_required), or is there a better way of accomplishing this?