Flask redirect with authentication

China☆狼群 提交于 2019-12-25 16:09:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!