【发布时间】:2023-04-02 18:22:01
【问题描述】:
如何形成来自 Flask python 服务器的响应,该响应将在响应中包含不记名令牌。更准确地说,我希望以某种方式将 JWT 令牌从 Flask python 服务器安全地传播回客户端(角度页面)。我可以在 GET 重定向中以查询字符串的形式返回它。将 JWT 访问令牌返回给客户端还有哪些其他可能性?我尝试设置响应表单 python,并在授权字段中设置 jwt 令牌,但没有任何效果。这是我尝试过的:
1.
r = Response(headers={
"Authorization": "bearer jwtcntent",
"Access-Control-Allow-Origin": "*",
},
is_redirect=True,
url="https://localhost:5000/callback",
)
return r
r = redirect("http://localhost:5000/callback")
r.headers = {"authorization": "bearer jwtcntent"}
return r
r = Response(headers={
"Authorization": "Bearer jwtcntent",
"Access-Control-Allow-Origin": "*",
},
allow_redirects=True,
url="https://localhost:5000/callback",
)
return r
有什么建议吗?
【问题讨论】:
标签: python api flask jwt response