cookies

Laravel 5.2: retrieving a cookie via blade returns null also if cookie is set

落爺英雄遲暮 提交于 2020-01-13 10:12:20
问题 I set a cookie my_cookie via Javascript function createCookie(name, value, days) { var expires; if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); expires = "; expires="+date.toUTCString(); } else { expires = ""; } document.cookie = name+"="+value+expires+"; path=/"; } .... createCookie('my_cookie', 1, 365); .... Via Chrome Cookie Inspector I see that the cookie is created with value 1. Via Laravel Blade I tried: @if (Cookie::get('my_cookie') !== null) // or

Default session expiration timeout?

可紊 提交于 2020-01-13 09:06:12
问题 By default the JSESSIONID cookie is expired when you close the browser, but how long is the associated HttpSession really valid on the server side? 回答1: It defaults to 30 minutes on most containers which you can configure by <session-config> in your webapp's web.xml . <session-config> <session-timeout>10</session-timeout> </session-config> The above example will change the server side session timeout to 10 minutes. So in other words, when the client do not interact with the server for more

Is a PHP Session acceptable with the new UK cookie law?

蹲街弑〆低调 提交于 2020-01-13 07:47:12
问题 I am just looking for some advice on the new UK Cookie Law and how it affects PHP sessions. I understand that you do not need the users to opt in when a cookie is "strictly necessary" and the example given is adding an item to a shopping cart. I am using similar functionality that remembers what you have stored in a contact form, which I feel is strictly necessary use of a session and therefore no opt in is required. However the confusion for me arises because I have a session_start(); at the

Spring Security: How can I set a RememberMe cookie url path, that differs from the context path?

风格不统一 提交于 2020-01-13 06:28:49
问题 How in Spring Security can I set a RememberMe cookie url path, that differs from the context path? Supposing my website's homepage url is (url rewrite): https://www.mysuperspecialdomain.com And that my login page has a url like this: https://www.mysuperspecialdomain.com/shop/account/login After succesful login the RememberMe cookie has the path /shop (visible in the browser, e.g. Chrome). This is the project's context path. This leads to the situation, that when I'm going to my homepage,

Cross-domain user tracking without 3rd party cookies?

只谈情不闲聊 提交于 2020-01-13 05:57:31
问题 How are cross-domain web tracking services implemented (e.g., for behavioral advertising ), now that the majority of people are browsing with 3rd party cookies disabled? More explicitly, how does a third party tracking service recognize that two requests to different domains are coming from the same person? Some options come to my mind: Maybe iframe-based , by embedding a tracking page from the third-party tracking service into various sites. This included tracking page should be able to set

How and when do I generate a Node/Express cookie secret?

痞子三分冷 提交于 2020-01-13 04:55:06
问题 I'm building a node/express app and am using the express-session and mongo-connect modules to store my sessions and persist them on restart. However, a new cookie ID is still generated every time I restart the server. I've narrowed the problem down to my session secret, which is a randomly generated string of 16 chars Here is my session code: app.use(session({ secret: dbops.randomString(16), // generate a 16 random char string saveUninitialized: false, resave: true, store: new MongoStore({ db

Curl and cookie

落花浮王杯 提交于 2020-01-13 04:45:00
问题 I'm using cURL to log in a website, but I don't know how to get/use the cookies I get. Does anybody has an idea? Thanks 回答1: http://ask.metafilter.com/18923/How-do-you-handle-authentication-via-cookie-with-CURL 回答2: Maybe, this example will help... #!/bin/bash COOKIE_FILE="cookie.tmp" MAIN_URL="http://localhost:8080/monitor" if [ -e $COOKIE_FILE ] ; then rm $COOKIE_FILE fi curl -d "j_username=user&j_password=pass" -c $COOKIE_FILE "$MAIN_URL/j_spring_security_check" DATA=`curl -b $COOKIE_FILE

express cookie return undefined

左心房为你撑大大i 提交于 2020-01-13 03:11:08
问题 I'm trying to set cookie on express.js but it return undefined. I've searched many web pages and put express.cookieParser() above app.use(app.router) but it still can't return the right value. app.js app.configure(function(){ var RedisStore = require('connect-redis')(express); app.use(express.logger()); app.set('view options', { layout: false }); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.bodyParser({uploadDir: './uploads/tmp'})); app.use(express

asp.net-core2.0 user auto logoff after 20-30 min

╄→尐↘猪︶ㄣ 提交于 2020-01-12 13:55:30
问题 Few days ago I have decided to upgrade my web app from asp.net core 1.1 to core 2.0. Everything seems to work fine after minor changes, except authentication does not persist longer than 20-30 minutes. We can take the default example from Visual Studio because I experience the same problem in my own webapp and in "ASP.NET Core Web Application" -> .NET Framework 4.6.1 + ASP.NET Core 2.0 + MVC + Individual User Accounts . Configuration is default and should be users logged in for 14 days:

How to access a browser cookie in a react app

喜欢而已 提交于 2020-01-12 09:18:06
问题 This question is a bit popular but Im not having such luck. Im mostly a backend person so Im learning as I go along. I have a cookie named connect.sid and value of 12345 . I see this in my chrome dev tools. In my react app I console logged document.cookie and localStorage.getItem('connect.sid') . Im getting null values. How to get the value of 12345 ? Passportjs, using passport-github2 strategy, created this cookie. I need access to it so I could talk to my API. Thanks 回答1: Using react-cookie