如何使用javascript阅读flask会话? [英] How to read flask sessions using javascript?

查看:52
本文介绍了如何使用javascript阅读flask会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个安全的烧瓶会话

I have a secured flask session

<代码>会话= xC4tHoSZQVSHpVtnHUONYb/obAA =?USER_TOKEN = UycuZUp3Rndja1JnREFJQU1CZThwWVpqbkRWNHZpQW9QMlg0TzY5ZXN4MU5rTlZOaEM5RERuczBCRkRqSHFDY0YxTGZMSUM3WlNHdkxhZEpJUjZXcjh4ekZyUEQ5aUxFMEEuVGt0V3RqdTFKblVBVzV2SnRpSjd3M0NJZFdRJwpwMQou"

我正在使用 angular.js cookie来检索值,但它给了我什么都没有.

I am using angular.js cookies to retrieve the value but it gives me nothing.

console.log('token - ' + $cookieStore.get('USER_TOKEN'));

如何使用Javascript访问 USER_TOKEN 的值?

How can I access the value of USER_TOKEN using Javascript?

推荐答案

对此我可能完全矛盾,但是我一直了解到,由于某些内部原因,您无法使用Javascript访问会话数据是Werkzeug安全cookie模块使用的.我已经计划尝试将此代码段作为一种解决方法:

I could be completely contradicted on this, but I've been of the understanding that you can't access the session data with Javascript because of some of the internals that the Werkzeug secure cookie module uses. I've got plans to try out this snippet as a workaround:

http://flask.pocoo.org/snippets/51/

但是直到我有机会尝试它之前,我不知道它是否可以解决Flask基本会话模块所缺少的某些功能.

But until I get a chance to try it I wouldn't know whether or not it could do some of the things lacking with the basic session module of Flask.

这篇关于如何使用javascript阅读flask会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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