问题
In Flask, how would I redirect AND provide credentials.
For example:
redirect('http://url:5000', auth=(username, password))
回答1:
redirect(url_for('.view_function', username=username, password=password))
These parameters can then be accessed as parameters passed to your view function.
However, this isn't the right way to keep a track authorization (I'm assuming that is what you're trying to do here). Your information could easily be breached as all credentials (including the password) would be available in url for anyone to see and access.
Keeping that in mind, you should look into Flask-login. It's a pretty secure login manager.
来源:https://stackoverflow.com/questions/34245814/flask-redirect-with-authentication