问题标签 [cookiestore]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - 删除并刷新后cookie仍然存在
我正在尝试使用删除用户的身份验证cookie $cookieStore.remove('.ASPXAUTH')
,但如果我之后刷新页面,cookie仍然存在并且页面仍然可用,而不是像我期望的那样将用户重定向到登录页面。
为什么我删除认证cookie并刷新页面后用户仍然可以查看页面?
angularjs - 一口气清除 angularJS $cookieStore 的方法,而不是一个一个一个一个的 cookie?
目前,使用 angularJS 的 $cookieStore,我在注销时一一清除 cookie。
我检查了控制台中的 $cookieStore 对象,发现它看起来像这样。
有什么方法可以在不删除单个 cookie 的情况下清除 $cookieStore 中的所有 cookie?
httpclient - 使用 apache httpclient 作为基于 PoolingHttpClientConnectionManager 的球衣客户端的后端
我尝试使用 apache httpclient 作为 jersey 客户端的后端来自动处理 cookie,这是我的代码
我尝试使用 apache httpclient 作为 jersey 客户端的后端(为了处理 cookie)
然后,我创建了一个简单的类来测试客户端,
所以,我使用同一个客户端来访问同一主机下的服务。我可以成功获得“auth”和“result1”的响应,但客户端在以下部分停留在“result2”
我尝试修改以下部分:
然后,ApiTest 工作,不会卡住。我想连接存在一些问题,因为默认情况下,poolingHttpClientConnectionManager 的每个路由的最大值为 2,所以我的 ApiTest 将停留在第三个请求中。我认为连接已经释放,因为我已经使用了响应实体,
但它似乎根本不起作用,连接似乎没有释放。
任何人都可以帮忙吗?欣赏!
cookies - 如何为临时 NSURLSession 设置 cookieAcceptPolicy
我正在尝试使用临时 NSURLSessions 为我的应用程序中的多个任务提供单独的 cookie 处理。这些任务不直接绑定到 UI。问题:无论我做什么,临时 NSHTTPCookieStorage 的 cookieAcceptPolicy 仍然是NSHTTPCookieAcceptPolicyNever。
这是我的代码:
NSLog 的输出总是:
其中 1 是 NSHTTPCookieAcceptPolicyNever 的值(对于 NSHTTPCookieAcceptPolicyAlways 应为 0)。响应中的标头在那里。
我可以做些什么来让 NSHTTPCookieStorage 在会话活动时记住我的 cookie?我不需要也不想要任何坚持。我只想将 cookie 保存在内存中,以便在同一会话中将它们重用于进一步的请求。
angularjs - $cookieStore 不为方法的另一次迭代保存数据
我有一个应用程序,其中我为数组(configurationsArray)中的每个项目(配置)设置了复选框。我要实现的是在选中复选框时将配置添加到 cookie 存储中
这是我的代码
如果你最后看到我尝试获取我推送到 cookieStore 中的东西,它工作正常。
但是,当检查另一个复选框并再次执行该方法时,我看到开头返回的值具有一个空数组。我在这里做错了什么?任何指针都非常感谢。
angularjs - AngularJS - Call Login Controller when cookieStore found
I have the following code:
The goal of this code is that when the app runs it checks the cookiestore for saved credentials. If it finds credentials I want it to call the function login() from the Login Controller defined below:
It is currently complaining that LoginCtrl doesn't exist and I've tried various ways to try to define the LoginCtrl (myApp.controllers.LoginCtrl, myApp.LoginCtrl, etc) but none seem to work.
Any advice on this please? I don't want to save a user object in the cookie, I'd rather save the credentials with a hashed password.
Thank you for any help and advice you can provide!
angularjs - 将选择选项传递到新页面
我需要从一个页面上的 ng-option 下拉列表中传递当前选择的选项,并使其成为另一页面上 ng-option 下拉列表的默认选择。
我可以将选定的选项保存到 $cookieStore 并将其传递到下一页。但我不能让它成为新页面下拉列表中的预选默认选项。
在控制器 1 上,我有:
这会填充初始下拉列表并使“a”成为默认选项。
我还有下面的代码,它将选定的选项保存到 $cookieStore:
在控制器 2 上,我有以下代码获取 $cookieStore 值:
$scope.selectType.name 返回之前选择的选项名称。但我不知道如何将它与新的下拉菜单匹配,并使其成为下拉菜单的默认选择。
并且 ng-option 似乎不允许您提取 Angular 分配给每个选项的值以在另一个控制器上使用,所以我无法匹配。
angularjs - 使用 ngCookies/$cookiestore 跨域共享 cookie
我想使用 ngCookies,这样我就可以在同一域下的另一台主机上重新使用登录 cookie。这样,当我登录 app1.example.com 并访问 app2.example.com 时,我将不再需要登录。它将使用在 app1.example.com 中创建的 cookie。有人可以分享一个我可以阅读的链接。
谢谢!
angularjs - 使用 1.4 版本的 AngularJS,是否可以使用 $cookies 创建持久性 cookie?
使用 AngularJS 的 1.4 版本,是否可以创建持久性 cookie $cookies
?
我希望在登录后存储数据,例如 7 天。在 1.3.X 版本中,甚至无法设置到期日期。但是在 1.4 中,他们已弃用$cookieStore
并设置了$cookies
到期日期选项。
我想知道这是否会在所需的更长时间内创建 cookie,而不是关闭浏览器然后一切都消失了。
android - Android HttpClient 接受所有 cookie
我是 Android 世界的新手,也许我的问题很简单。我有一个 android 应用程序,我使用 HttpGet 连接到服务器并收集数据。但是,服务器有时会设置一些我的代码不记得的 cookie。我发现了一个帖子,它使用自定义 cookie 策略并接受所有内容.. 正是我需要的。但我无法实现它。据我所知,我的 java httpclient 版本很旧,没有我需要的功能。这是我的代码:
我需要实现的代码:
我只需要为我的客户设置这个 csf 策略。但是似乎我在库中没有这两个函数:setCookieStore 和 getCookieSpecs().register()
我有什么选择来运行它?!