cookies

What am I missing about express sessions and cookies?

こ雲淡風輕ζ 提交于 2020-08-22 04:32:50
问题 I've gotten pretty far with express and express-session and express-sql-session. I've got it creating a row in the database for a session when a user logs in. This is how I set it: //login route handler this.bcrypt.compare(password, row.hashed, function(err, passwordsMatch) { if (passwordsMatch === true) { console.log("user now logged in"); req.session.user = row; req.session.success = 'User successfully logged in'; res.send(row); res.end(); } }); Hunky dory! I can hop into my session table

What am I missing about express sessions and cookies?

耗尽温柔 提交于 2020-08-22 04:31:59
问题 I've gotten pretty far with express and express-session and express-sql-session. I've got it creating a row in the database for a session when a user logs in. This is how I set it: //login route handler this.bcrypt.compare(password, row.hashed, function(err, passwordsMatch) { if (passwordsMatch === true) { console.log("user now logged in"); req.session.user = row; req.session.success = 'User successfully logged in'; res.send(row); res.end(); } }); Hunky dory! I can hop into my session table

Cookie loses value in ASP.net

↘锁芯ラ 提交于 2020-08-21 09:14:07
问题 I have the following code that sets a cookie: string locale = ((DropDownList)this.LoginUser.FindControl("locale")).SelectedValue; HttpCookie cookie = new HttpCookie("localization",locale); cookie.Expires= DateTime.Now.AddYears(1); Response.Cookies.Set(cookie); However, when I try to read the cookie, the Value is Null. The cookie exists. I never get past the following if check: if (Request.Cookies["localization"] != null && !string.IsNullOrEmpty(Request.Cookies["localization"].Value)) Help?

Cookie loses value in ASP.net

☆樱花仙子☆ 提交于 2020-08-21 09:12:42
问题 I have the following code that sets a cookie: string locale = ((DropDownList)this.LoginUser.FindControl("locale")).SelectedValue; HttpCookie cookie = new HttpCookie("localization",locale); cookie.Expires= DateTime.Now.AddYears(1); Response.Cookies.Set(cookie); However, when I try to read the cookie, the Value is Null. The cookie exists. I never get past the following if check: if (Request.Cookies["localization"] != null && !string.IsNullOrEmpty(Request.Cookies["localization"].Value)) Help?

“Role” Claim is missing from the token - NET CORE 3.1 & IS4

心不动则不痛 提交于 2020-08-10 19:23:17
问题 I have a service which is responsible for authenticating users. After updating: IdentityServer4 from 2.3.2 to 4.0.2; an issue popped up: The token does not contain the required user claims anymore. The service is configured this way: The Startup.cs contains: applicationBuilder.UseCookiePolicy(); applicationBuilder.UseIdentityServer(); applicationBuilder.UseAuthorization(); //... mvcCoreBuilder.AddAuthorization(ConfigureAuthorization); var auth = mvcCoreBuilder.Services.AddAuthentication

Cookies headers are present but Cookies are not stored in browser

人走茶凉 提交于 2020-08-09 07:00:38
问题 Please help me to figure out why the browser (Chrome and any others) does not set cookies, while Set-Cookie header is present in Response Headers: Access-Control-Allow-Origin: * Connection: keep-alive Content-Length: 345 Content-Type: application/json; charset=utf-8 Date: Sat, 18 Jan 2020 21:15:53 GMT ETag: W/"159-UXuykOchcveuYBb7xZpN5Luf3jU" Set-Cookie: jwt=************; Path=/; Expires=Fri, 17 Apr 2020 21:15:53 GMT; HttpOnly Strict-Transport-Security: max-age=15552000; includeSubDomains X

Setting cookie to expire after one day

蹲街弑〆低调 提交于 2020-08-09 06:45:54
问题 I have used this code I got from git. Its basically set up to set a cookie to display a popup on the first visit to the site only. However, I want it to only set it for 24 hours. So if someone comes back to the site in a day or two it will show again. (function ($) { 'use strict'; $.fn.firstVisitPopup = function (settings) { var $body = $('body'); var $dialog = $(this); var $blackout; var setCookie = function (name, value) { var date = new Date(), expires = 'expires='; date.setTime(date

Setting cookie to expire after one day

99封情书 提交于 2020-08-09 06:45:02
问题 I have used this code I got from git. Its basically set up to set a cookie to display a popup on the first visit to the site only. However, I want it to only set it for 24 hours. So if someone comes back to the site in a day or two it will show again. (function ($) { 'use strict'; $.fn.firstVisitPopup = function (settings) { var $body = $('body'); var $dialog = $(this); var $blackout; var setCookie = function (name, value) { var date = new Date(), expires = 'expires='; date.setTime(date

cookie is not shown in chrome developer tools

旧街凉风 提交于 2020-08-06 07:28:57
问题 i am using node/express server and angularjs as frontend. server sets the cookie and is shown correctly in the network response. but the cookie is not shown in the resource tab in the chrome developer tools. What are the possible reasons for the same. 回答1: Below are 2 potential reasons for not actually setting a valid cookie: Invalid expiration time - the cookie expires at a time in the past from the browser's perspective Invalid domain for the cookie. Let's say you serve the page from

cookie is not shown in chrome developer tools

自古美人都是妖i 提交于 2020-08-06 07:28:27
问题 i am using node/express server and angularjs as frontend. server sets the cookie and is shown correctly in the network response. but the cookie is not shown in the resource tab in the chrome developer tools. What are the possible reasons for the same. 回答1: Below are 2 potential reasons for not actually setting a valid cookie: Invalid expiration time - the cookie expires at a time in the past from the browser's perspective Invalid domain for the cookie. Let's say you serve the page from