Questions tagged [session-cookies]

Session cookies enable a server and a browser to establish an identified connection (through cookies) and communicate though it.

Session cookies are temporary files that exist for a particular user for a pre-defined duration. Once this duration is expired, the session cookies are erased.

Session cookies allow a website to keep a state or memory of the visitor as they navigate between pages of the website.

4816 questions
25
votes
2 answers

Express 4 Sessions not persisting when restarting server

I have an Express 4 app setup to have sessions. // Sessions app.use(cookieParser()); app.use(session({ secret: "some-secret" })); // Signup app.post("/signup", function (req, res) { create_user(req.body.user, function (err, user_id) { …
eldosoa
  • 295
  • 1
  • 4
  • 9
24
votes
6 answers

Most optimized way to delete all sessions for a specific user in Django?

I'm running Django 1.3, using Sessions Middleware and Auth Middleware: # settings.py SESSION_ENGINE = django.contrib.sessions.backends.db # Persist sessions to DB SESSION_COOKIE_AGE = 1209600 # Cookies last 2 weeks Each…
Dave
  • 12,408
  • 12
  • 64
  • 67
24
votes
3 answers

org.openqa.selenium.InvalidCookieDomainException: Document is cookie-averse using Selenium and WebDriver

I'm trying to push cookies to selenium firefox webdriver stored from previous session, but I got error: org.openqa.selenium.InvalidCookieDomainException: Document is cookie-averse I read this HTML Standard Cookie-averse and understand nothing at…
24
votes
6 answers

Session-only cookie for Express.js

http://www.javascriptkit.com/javatutors/cookie.shtml Session-only cookies, on the other hand, stores information in the browser memory, and is available for the duration of the browser session. In other words, the data stored inside a…
Alfred
  • 60,935
  • 33
  • 147
  • 186
24
votes
4 answers

Android session management

Is there a specific library for Android session management? I need to manage my sessions in a normal Android app. not in WebView. I can set the session from my post method. But when I send another request that session is lost. Can someone help me…
23
votes
7 answers

Asp.net Sessions Getting Crossed / Mixed Up

Few weeks ago we had one of our customers contacting us saying that sometimes when he creates an activity it gets created under someone else's name! We did some troubleshooting and couldn't find anything. We asked the user to contact us the next…
Houda
  • 835
  • 3
  • 11
  • 17
23
votes
2 answers

How to know when OWIN cookie will expire?

I would like to create some kind of countdown timer based on the time the OWIN cookie will expire. I am using OWIN with MVC 5 and from what I understand SlidingExpiration is on by default. I do not use 'session' as I need this app to live within a…
FrankO
  • 2,522
  • 6
  • 24
  • 34
23
votes
6 answers

how to unset cookie in PHP?

I need to figure out how to unset this cookie. Everything I tried so far has failed. This is how I am currently unsetting it and it doesn't seem to work. setcookie("user_id", $user_id, time() - 7200); This is how I set it: setcookie("user_id",…
arboles
  • 1,321
  • 4
  • 20
  • 39
22
votes
7 answers

Remember me Cookie best practice?

I read about many old questions about this argument, and I thought that the best practice is to set up a cookie with username,user_id and a random token. Same cookie's data is stored in DB at cookie creation, and when users have the cookie they are…
itsme
  • 48,972
  • 96
  • 224
  • 345
21
votes
3 answers

How to retrieve cookie from response retrofit, okhttp?

I am trying to retrieve Cookies values from API response for maintaining the backend session by setting cookie value to new API call in case the APP is closed : The response to API call from PostMan RestClient: RetrofitClient.java public static…
Anurag Dhunna
  • 544
  • 1
  • 5
  • 17
21
votes
5 answers

how do I test httpOnly cookie flag

I have set the following property in websphere for the jsession cookie com.ibm.ws.webcontainer.HTTPOnlyCookies. Any idea how best to test this using JavaScript in Firefox or IE?
streed
  • 241
  • 1
  • 2
  • 6
21
votes
5 answers

Why does the session id change when requesting through ajax in php?

I'm logged in on Banana.com. Banana has a api link on /app/ajax_loggedin. My website is Monkey. Monkey runs a simple GET json to banana's /app/ajax_loggedin, which returns a loggedin value either 1 or 0. Why is it always returning 0 when it's…
Karem
  • 17,615
  • 72
  • 178
  • 278
21
votes
3 answers

How to clear cookies in angular.js

Currently am using angulajs app. I want to store some values in cookie. So i used angular-cookies-min script for add some values to cookies I have used this below code for save values to cookie. $cookieStore.put("userInfo", userInfo);//userInfo is…
user2998788
20
votes
2 answers

Setting Google Tag Manager cookies with SameSite and Secure attributes

Chrome is reporting the following warning: A cookie associated with a cross-site resource at https://www.googletagmanager.com/ was set without the SameSite attribute. A future release of Chrome will only deliver cookies with cross-site requests if…
20
votes
5 answers

Laravel Session always changes every refresh / request in Laravel 5.4

So the title basically says it all, I am using Laravel 5.4, PHP 7.1 and on my local machine sessions are working just fine. Essentially when trying to login or reloading the page every time I get a new CSRF token which breaks everything. I am using…
CMOS
  • 2,727
  • 8
  • 47
  • 83