Questions tagged [session-cookies]

Session cookies allow for a server and browser to establish a unique connection using cookies, facilitating communication between the two.

Having trouble saving the server-sent cookie on the browser. Employing Axios on the client side

Here is my express code where I am utilizing express-session to manage storage and work with cookies. Since version 1.5.0, the module no longer requires cookie-parser to handle storing the cookie in req/res. The session data is stored in a PSQL database h ...

Session and cookie problems when using Selenium2 with PhantomJS and PHPUnit

Recently, I configured my ongoing project to operate using Selenium and PhantomJS. (Similar configuration as shown here: ) Despite this setup, I have been encountering the following error: {"errorMessage":"Can only set Cookies for the current domain","re ...

Unexpected Error: The axiosCookieJarSupport function is throwing a TypeError, functioning properly in Node.JS but not in .vue pages. What could

Struggling with a function that authenticates on a website, it runs smoothly in a basic node.js script but fails when executed from a .vue page within the NuxtJS framework. The error message received when running in the .vue page is TypeError: axiosCookie ...

Problem with session cookies not being included in cross-origin replies using Express, Redis, and Next.js

I am currently working on a project that involves using an Express.js backend in conjunction with a Next.js frontend. The backend utilizes the Redis and connect-redis packages for session management, while the server is deployed on Heroku with the Heroku-D ...

End browser without clearing session automatically

Is it possible to clear the session after closing the browser (not just the tab)? I would like to automatically log out any user who closes their browser. I tried configuring the settings in "system -> configuration -> web" and setting the cookie Lifetim ...

The Express.js application is unable to access the cookie that was previously set before initiating the route

After successfully logging in to my Yii2 + angularjs page, I store user data in a cookie using the following code snippet: $jwt = JWT::encode(array(1,2,3), 'myKey123') setcookie('myData', $jwt, time() + 3600); In order to access this ...

What is the best way to manage a session using JavaScript?

Currently developing a website that initially hides all elements except for the password box upon loading. Once the user enters the correct password, all webpage elements are revealed. Seeking a solution to keep the elements visible on reload by utilizing ...

Guide on transitioning a token authenticated user from an API to session-based authentication within a Flutter app through a Flutter web view

My goal is to achieve the following: imagine I have an authenticated user with an API token. When this user clicks a button, I want to open a web view and authenticate them using session-based authentication. https://i.stack.imgur.com/CsZ57.png This is wh ...

Difficulty encountered when saving cookies on the browser in the context of NEXTjs and Redux RTK query

Currently, I am immersed in a Django project for the backend. The XCRF token is being retrieved via API cookies, as depicted in the screenshot from Postman provided below. https://i.stack.imgur.com/zc68R.png Furthermore, access is granted through the red ...

Obtaining a cookie for the PHPUnit test involving Ajax functionality

When it comes to writing PHPUnit tests for ajax endpoints, I find it easy when the user doesn't need to be logged in. However, for the specific endpoint I want to test, the user must be logged in and I need to programmatically retrieve the cookie as part o ...

Encountering an AttributeError when attempting to retrieve the desired cookie

Below, it is evident that the dictionary contains a cookie with the attribute "name". Strangely enough, the code successfully ran once but now consistently throws this error: File "/Users/me/Documents/Programming/browzine/last draft.py", line 201, in <l ...

Revitalize and Rejuvenate Express Session

Within my application, I have implemented restrictions on certain actions and pages for users who are not logged in. The code snippet below demonstrates this restriction: var restrict = function(req, res, next) { if (!req.user) { console.log("US ...

Issue with Node.js: req.session data does not persist

Currently, I am working on integrating a login feature using express, nuxtjs, and express-session. The functionality works well without any issues until the page is refreshed. However, after refreshing the page, the session data is not retained. I have co ...

Trouble accessing session cookie during server-side request with getServerSideProps in Next.js

I'm currently facing an issue where I am trying to make a request to a backend service using Axios in getServerSideProps, but it is unsuccessful because the necessary session cookie for authentication is not included in the context.req headers. In this sc ...

The session is not being established despite the Set-Cookie header being transmitted

I am managing three services - be, fe, and auth. These services are all hosted on App Engine with a load balancer set up to keep them under the same domain. My goal is to create a session upon user login. The issue I'm facing is that even though the set-co ...

Managing cookies in an ExpressJS application that runs on the client-side as well

From my perspective, in order for a server side application to track which clients are interacting with it, it needs to store a cookie on the client containing the session ID. This is confirmed by the documentation of express-session, a widely used packag ...

Accessing a Jhipster login and authentication mechanism through a mobile application

Are you wondering how to acquire a session cookie and the CSRF token from jhipster, and then effectively utilize them in your mobile app API calls using HTTP session authentication? In your JHipster configuration, you can find a .yo-rc.json file that is g ...

Configuring the session expiration time in Node.js Express by setting it in the SessionStore rather than in a cookie

Every resource I have come across regarding Express Sessions focuses on setting the cookie expiration times. session.cookie.expires = null; // Browser session cookie session.cookie.expires = 7 * 24 * 3600 * 1000; // Week long cookie However, the cookie ...

Exploring techniques for retrieving Express.js session cookies on the server-side prior to sending a response

Utilizing Express-session, Connect-mongo, and PassportJS on a Node server, I have implemented the following validation function: expressApp.post('/login', function(req, res, next) { passport.authenticate('login', function(err, user ...

Utilizing Ephemeral and MaxAge parameters in express-session for enhanced session management

I'm working on implementing the session management for an express-js application using the express-session package. Here are the specific requirements I need to meet: The cookie should be destroyed when the browser is closed. The cookie should expi ...

What is the best way to retrieve a cookie sent from the server on a subdomain's domain within the client request headers using getServerSideProps

Currently, I have an express application using express-session running on my server hosted at api.example.com, along with a NextJS application hosted at example.com. While everything functions smoothly locally with the server setting a cookie that can be r ...

Troubleshooting problem with cookies in express-session

I've been working on an app with express.js and vue 3, incorporating session-based authentication. While everything functions perfectly locally, I've encountered issues when trying to deploy to production. Here's a snippet of the code where ...

`End session for inactive user after next authentication`

I am facing a challenge with managing inactive user sessions in my app. I tried setting the maxAge of ...nextauth to one minute and the refetch interval to 20s for SessionProvider, but encountered an issue where the session expiration on the browser cook ...

PHP and Ajax: Steps to start a session once a login is successfully completed (remaining code functions normally)

Hello everyone, I am currently learning PHP and seeking assistance with a new project. I am in the process of creating a login page where I have implemented an onclick event on a button to validate the email and password ("pass") entered by the user (ensu ...

The CSRF token is being rejected by the Drupal services/cors API

Currently, I am utilizing polymer to facilitate ajax requests to my Drupal services api. After sending a POST request to login and receiving a token in return, I proceed to send another POST request to create a node. Despite successfully passing the token ...

What are some ways I can utilize session and cookies for express when using express.static('static')?

Exploring the realm of session cookies in web development, specifically with an Express backend and a Vue PWA/SPA mounted on static files via express.use(express.static('static'));. Through some research, I discovered that we can include options ...

Session handling in PHP is not cross-server compatible

Why are PHP session variables not transferring across servers? This example is being used to troubleshoot the issue. Please review. file1.php <?php session_start(); $_SESSION['FirstName'] = Kshitij ; $_SESSION['LastName'] = Kawatra ; ...

AngularJS http requests fail to include session cookies when making CORS requests

Here is the script I am using: <script> function eventController($scope, $http) { $http.get("http://example.com/api/Event", {withCredentials: true}) .success(function (response) { $scope.even ...

In JavaScript, you can use the document.cookie property to delete specific cookie values identified by their names and values

Within my JavaScript code, I am working with a cookie that contains multiple names and values: "Token=23432112233299; sessionuid=abce32343234" When I download a file from the server, a new cookie is added to the document, resulting in the following cooki ...

After a period of time since the server has been initialized, the function req.isAuthenticated() no

In my Node.js routes.js file, I have a function implemented to check if a request is isAuthenticated before serving it: function isLoggedIn(req, res, next) { if (req.isAuthenticated()) { console.log('Session Expiry '+req.session.cookie.expires ...

Exploring session management in Django

I recently built a web application using Django. The app does not involve any login or logout activities, however, I have utilized session variables that are not being deleted. Could this potentially cause harm to my website's database? ...

Cookies that are set manually in Mahara will vanish once you navigate to the next page

Currently working on some code for mahara. I am attempting to store a variable in a cookie, but it seems to disappear when I navigate to the next page. For example: foo.php: ... $myfoo = 'bar'; setcookie('mycookie', $myfoo) var_dump($_COOKIE) ... When ...