带身份验证的烧瓶重定向 [英] Flask redirect with authentication

查看:72
本文介绍了带身份验证的烧瓶重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Flask中,我将如何重定向并提供凭据.

In Flask, how would I redirect AND provide credentials.

例如:

redirect('http://url:5000', auth=(username, password))

推荐答案

redirect(url_for('.view_function', username=username, password=password))

然后可以将这些参数作为传递给您的视图函数的参数进行访问. 但是,这不是保留跟踪授权的正确方法(我假设这是您要在此处执行的操作).您的信息很容易被破坏,因为所有凭据(包括密码)都可以在url中找到,任何人都可以查看和访问.
请记住,您应该查看烧瓶登录.这是一个非常安全的登录管理器.

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.

这篇关于带身份验证的烧瓶重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆