cookies

How to attach cookies to JSON Response in symfony2?

孤街浪徒 提交于 2021-02-07 19:16:17
问题 I have JSON endpoint which is used to add product to cart. It checks whether the cart already exists or no. If not then it creates a cart and the cart Id is stored in cookie. So I how do I attach cookie to the symfony2's JsonResponse ? In a non ajax version if I am rendering a template from my action I can use: $response = new Response(); $response->headers->setCookie(new Cookie(‘cookie_name’, ‘cookie_value’)); $this->render('<template_path>', '<array_options>', $response); Please help me on

How to attach cookies to JSON Response in symfony2?

血红的双手。 提交于 2021-02-07 19:12:14
问题 I have JSON endpoint which is used to add product to cart. It checks whether the cart already exists or no. If not then it creates a cart and the cart Id is stored in cookie. So I how do I attach cookie to the symfony2's JsonResponse ? In a non ajax version if I am rendering a template from my action I can use: $response = new Response(); $response->headers->setCookie(new Cookie(‘cookie_name’, ‘cookie_value’)); $this->render('<template_path>', '<array_options>', $response); Please help me on

JWT UnauthorizedError: No authorization token was found (GET request with cookie)

百般思念 提交于 2021-02-07 18:16:24
问题 I have a strange problem, or maybe I don't understand how JWT works in Express context. var express = require('express') var app = express(); var expressJWT = require('express-jwt'); var jwt = require('jsonwebtoken'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var unless = require('express-unless'); app.set('secret', 'some secret'); app.use(cookieParser()); app.use(bodyParser.urlencoded({ extended: false })); app.use("/", expressJWT({secret:app.get(

Is it possible to disable third-party cookies while on my site on behalf of users?

余生颓废 提交于 2021-02-07 14:28:07
问题 I have a website that loads a resource from another website. I've been able to determine that: The third-party website places cookies on the user's browser. If I disable third-party cookies in my browser settings, the third-party website is no longer able to place cookies on the browser. The resource still works properly. I'm wondering if there is some kind of header or other directive I can deliver from my website that will have the same effect for my users as if they had disabled third

How to create a non-persistent (in memory) http cookie in C#?

对着背影说爱祢 提交于 2021-02-07 13:21:43
问题 I want my cookie to disappear when the user closes their brower-- I've already set some promising looking properties, but my cookies pop back to live even after closing the entire browser. HttpCookie cookie = new HttpCookie("mycookie", "abc"); cookie.HttpOnly = true; //Seems to only affect script access cookie.Secure = true; //Seems to affect only https transport What property or method call am I missing to achieve an in memory cookie? 回答1: This question has been posted online 1000+ times.

How to create a non-persistent (in memory) http cookie in C#?

风格不统一 提交于 2021-02-07 13:21:28
问题 I want my cookie to disappear when the user closes their brower-- I've already set some promising looking properties, but my cookies pop back to live even after closing the entire browser. HttpCookie cookie = new HttpCookie("mycookie", "abc"); cookie.HttpOnly = true; //Seems to only affect script access cookie.Secure = true; //Seems to affect only https transport What property or method call am I missing to achieve an in memory cookie? 回答1: This question has been posted online 1000+ times.

How to delete cookie on codeigniter

纵然是瞬间 提交于 2021-02-07 12:21:59
问题 I don't know how to delete a cookie. I want is when I submit a form. The cookie is also delete. I try the delete_cookie("name") but is not working. I think because the cookie I created by javascript . Please check my code to fix this problem. This is my sample text field: <input name="cargo_no" type="text" class="validate[required]" id="cargonumber" onchange="setCookie('cargonumberC', this.value, 365);"/> and this is the javascript function setCookie(cookieName, cookieValue, nDays) { var

How to delete cookie on codeigniter

依然范特西╮ 提交于 2021-02-07 12:19:59
问题 I don't know how to delete a cookie. I want is when I submit a form. The cookie is also delete. I try the delete_cookie("name") but is not working. I think because the cookie I created by javascript . Please check my code to fix this problem. This is my sample text field: <input name="cargo_no" type="text" class="validate[required]" id="cargonumber" onchange="setCookie('cargonumberC', this.value, 365);"/> and this is the javascript function setCookie(cookieName, cookieValue, nDays) { var

In .NET Core 3.1, the RequestCookieCollection can no longer be used to create cookies in unit tests

我只是一个虾纸丫 提交于 2021-02-07 12:14:25
问题 I have just upgraded from .NET Core 2.2 to 3.1. I have tests to confirm that extension methods I've added to HttpContext.Request are working. I was previously able to do things like: var context = new DefaultHttpContext(); var c = new Dictionary<string, string> {{"test", "passed"}}; context.Request.Cookies = new RequestCookieCollection(cookies); var result = context.Request.GetPrimedValue(); Is this impossible now? I tried using Moq for this, but there are far too many things blocking me from

In .NET Core 3.1, the RequestCookieCollection can no longer be used to create cookies in unit tests

自作多情 提交于 2021-02-07 12:12:13
问题 I have just upgraded from .NET Core 2.2 to 3.1. I have tests to confirm that extension methods I've added to HttpContext.Request are working. I was previously able to do things like: var context = new DefaultHttpContext(); var c = new Dictionary<string, string> {{"test", "passed"}}; context.Request.Cookies = new RequestCookieCollection(cookies); var result = context.Request.GetPrimedValue(); Is this impossible now? I tried using Moq for this, but there are far too many things blocking me from