All Questions
1,365 questions
0
votes
0
answers
17
views
discord oauth2 login session persistence lost on mobile after redirect
I'm working on a Discord login integration for my app, and it's mostly working, but I'm running into an issue with authentication persistence.
The login works fine on desktop — I'm redirected to ...
0
votes
0
answers
22
views
How to store session data in express properly
I have a 4.x express app. I would like to store data in the session after user has successfully logged in. When I try to access this data in another request the data is always undefined.
Here is my ...
1
vote
1
answer
21
views
saveUninitialized and resave in session (node js)
When to use saveUninitialized and resave in express-session ?
I'm newbie for Mern stack and am trying to implement session management. where I came across "express-session", I found a common ...
0
votes
0
answers
9
views
express js session not being maintained
I separated the front end back end and implemented it, but even if I run an api like the bottom, it is only saved in the session at the beginning and there is nothing in the session if I call it up ...
0
votes
0
answers
21
views
Express session expires after a post request from external URLs
I am trying to implement a bank payment system using the Express framework.
According to the bank's docs, It starts by redirecting the user to a specific URL like this:
res.redirect("https://pec....
0
votes
0
answers
46
views
Can't delete the session of another user in nodejs
I am using session based authentication for the first time. I have been reading and wathcing tutorials. I would like to know how to end the session of another user.
I know that I can use this line of ...
0
votes
0
answers
22
views
req.session not updated after saving them and sending an axios post request
so I am working on my login system, and if a user clicks a link which takes them to another page and their session has expired, it will simply get them to login again and after redirect to that page. ...
0
votes
0
answers
44
views
TypeScript Error: Property 'userId' does not exist on type 'Session & Partial<SessionData>'
I'm encountering a TypeScript compilation error related to session management in my Node.js application. Here is the error message I receive:
D:\Web Dev\RAHI\Backend\node_modules\ts-node\src\index.ts:...
0
votes
0
answers
17
views
Unable to save and access session data. Express server and Angular front end
I'm new to Express and Angular and this is my first time posting a question on SO. I'm working on an app in which I want to be able to maintain session data. Once a user is logged in I want to store ...
0
votes
0
answers
24
views
Cookie-session only works within the route I apply the data to
I am working on a project in express. I need to get certain fields from a login route into a session on the backend, so I can call the data from different routes. The problem is that when I try to ...
0
votes
1
answer
33
views
How to share session cookie between a Koa app and Experss app?
I have an API built using Koa v2 and we have a cookie session based authentication. For that, we use the koa-session library and it works. But now, we are migrating our API to NestJS, using express as ...
0
votes
0
answers
27
views
Save session information in Postgres with cutom Session model for express
I want to use session for an express back-end authentication & authorization using express-session library. I also want to persist the session in Postgres with custom schema as defined in the ...
0
votes
1
answer
42
views
Express session variable is undefined on other routes after defining it in the login route
I've seen this question be asked many times, but there is still no answer after I've gone through a dozen similar questions. The core of the problem is I have a node server with a mongodb database, ...
0
votes
1
answer
58
views
How can I set up Express-Session cookies in Safari using two different Fly.io apps?
Host: fly.io
Server: Node-Express
Front-end: Vite-React
I am using Fly.io for both the front-end and the server. I am using express-sessions for user auth. Safari will not save the session cookies in ...
0
votes
1
answer
36
views
Why does clearing all sessions make my NestJS app unresponsive?
I have a NestJS app, with a special Admin route I want to be able to call to clear out all user sessions (for example: after we deploy a new version of the application so we can kick everyone out).
I ...
0
votes
0
answers
19
views
Session Cart Resets After First Product Addition in Express.js Application
I'm building an online store application using Express.js, and I'm having trouble with session persistence. The cart works fine the first time I add a product, but if I add another product or make any ...
0
votes
1
answer
222
views
Session not persisting after redirect during Google OAuth 2.0 flow
I have been working on this bug for a while now, I can break it down in detail but can't solve it, so any help would be greatly appreciated.
Currently Req.user and req.session are not persisting after ...
0
votes
1
answer
36
views
Deleted user remains logged in despite account deletion
I'm encountering an issue where users remain logged in even after their accounts have been deleted by an admin in my Express.js application using MongoDB for user data storage.
When an admin deletes a ...
0
votes
1
answer
47
views
What If Session Expires While User Is Still On The Website
Suppose that there are 5 minutes left for the session to expire when user enters the website.Every action that user will make after 5 minutes will be rejected by server if it requires you to login and ...
0
votes
1
answer
41
views
Issue with back button navigation after login in Node.js Express using sessions and cookies
I've implemented a basic login system using session and cookies in Node.js Express. After successful login, users are redirected to /home to see a welcome page. However, when users click the browser's ...
2
votes
0
answers
62
views
express-session not working in deployement but working in development
I worked on a MERN project and everything was going well in development(local) mode. When i hosted my code on vercel i noticed that session are not working properly. my mentor suggested to create a ...
0
votes
0
answers
47
views
req.session.userId returns undefined
Please guys come to my aid. I have battling this issue for weeks now.
I am currently taking the Ben Awad Full-Stack course and I'm having trouble with the express-session part.
Whenever I try to ...
0
votes
0
answers
33
views
Express JS connect-flash requires manual additional page reload
My flash messages seem to require an additional manual reload of the page for them to appear.
Here's an example of how I'm using it:
if (password.length < 12) {
req.flash('error', '...
1
vote
0
answers
18
views
passport serialize/deserialize user google login problem
why if a user logged in with google makes a post to secrets the req.user only includes the googleId but when its a normal user it contains all the object stored in the db im trying to use the objectId ...
0
votes
1
answer
210
views
Express-session store not deleting session when using req.session.destroy()
Using express-session and connect-mongodb for session based authentication (or trying to at least). I have a logout route that is calling req.session.destroy(), I have the unset property set to "...
0
votes
0
answers
22
views
"Remember Me" functionality usng PassportJS with express-session and connect-redis not working on browser restart
passport.use(
'local',
new LocalStrategy(
strategyOptions,
async (
req: Request,
email: string,
password: string,
done: (error: any, user?: any, options?: ...
0
votes
0
answers
39
views
Session doesn't show value on changing routes
Express session doesn't show value on changing routes. Here in '/login' route it shows req.session.user data, but in '/connect' it shows req.session.user is undefined
Here is the code
import express ...
0
votes
0
answers
37
views
Session Cookie Not Persisting in Browser on Fetch/Axios Request with Express, Passport, and NextJs
I've been working on an authentication flow using Express, Passport, and Redis for session management on the backend, with a React (Next.js) frontend. The sessions are correctly created and stored in ...
0
votes
1
answer
92
views
express-session issue with cookies
I am building an app using express.js and vue 3, and I am using session based auth, it is working great on local.
However it is not working in production. here is my code for configuring the session ...
0
votes
0
answers
78
views
How to set cookie on localhost on developing environment currently?
I'm on a session authentication work with nextjs and express. I installed express-session and finished a session login function, tried on postman and it works fine.
But when I call the login request ...
0
votes
0
answers
16
views
Cant handle Session's cookie when Safari/iOS
Browser cant send back the cookie when is safari/ios
const corsOpt = {
origin: ['mydomain.com', 'http://localhost:5173'],
credentials: true,
};
...
server.set('trust proxy', 1);
server.use(cors(...
-1
votes
1
answer
23
views
Session custom property getting undefined when calling Node js API from Javascript fetch
I am developing a User Login Project where Apis are written in node js and express, UI part is written in HTML and Javascript. These both are two individual projects.
When User logins, a fetch cal is ...
0
votes
0
answers
40
views
I'm having problems with client-side session creation, the browser doesn't save the session ID
Context: In the API I am working with express-session in NodeJS to create the sessions, I am just testing, therefore the sessions are stored in memory on the API side, I am using two different domains ...
0
votes
0
answers
104
views
NodeJS Express session is working in localhost but not working in Linux live server
I am trying to adjust my NodeJS Express project to use a Session Timeout of 2 Hours. Default timeout is 10 Minutes as I have checked.
Below I have attached my app.js and login.js files codings. While ...
1
vote
1
answer
52
views
Session not properly being passed for login and authentication
I am trying to learn how sessions work. I know that in the server side, req.session.user = { id: 1, username: 'user1' }; is being read correctly but when I hit the endpoint /check-session req....
0
votes
0
answers
17
views
Cookie is destroyed once I switch the page
My program logs in (in login.html) and the express session cookie is created. Once the page is switched to index.html, the cookie is lost. I am using the live port extension running of port 5500 ...
3
votes
1
answer
205
views
Value saved to Express session is not present on later requests
My app is acting as an OAuth server for a 3rd party service which will be accessed through an in our app. The authentication process all happens behind the scenes without an intermediate screen for a ...
0
votes
0
answers
22
views
Different route handlers unable to access req.session.isSupervisor value in react-express-mysql website
I am working on an auditing website with two user roles - supervisors and team members. The user logs in to the system using his unique user ID and password. Whether the user is a supervisor or not is ...
1
vote
0
answers
41
views
Session Authentication Fails on Express Server After Google OAuth Login
I'm developing a MERN stack application with a React frontend hosted on Surge (https://thestudyapp.surge.sh) and an Express backend hosted on Render (https://study-app-server.onrender.com). I've ...
0
votes
0
answers
31
views
res sessions not saving
Currently I have my applications hosted and am now tryingto get my request sessions to work. Once I hosted my websites I realized that after logging in with google oauth, a user was made in my ...
0
votes
1
answer
81
views
Express Session manually assign session
Something I don't understand about the express session middleware is the reassignment of sessions. E.g. When someone opens my page for the first time, the middleware will create a fresh new session ...
0
votes
0
answers
27
views
How do I go about session handling considering my approach?
I currently have a decent authentication logic in place which will verify credentials against the database document/entry.
Once a login request has a successful response, I set a httpOnly cookie ...
1
vote
0
answers
24
views
About the deserializeUser function not running in the passport library
I have an application that is currently being developed.
The front end is running at localhost:3000 and the back end is running at localhost:4000.
When I tried to log in, I successfully checked the ...
1
vote
0
answers
97
views
express session undefined session problem
Friends, I have codes where I perform session operations with 'Express', 'express-session', 'ioredis' and 'connect-redis'.
I can successfully register the user session. However, I want to write the ...
0
votes
0
answers
93
views
How to get express-session cookie on frontend in production with Railway express backend and Railway CRA frontend?
I have a create-react-app frontend and an expressjs backend api using express session cookies for session management. My application runs perfectly on localhost including the cookies being saved ...
1
vote
0
answers
81
views
How to set first party session cookie on the browser from diffrent domain
I am using express-session on the backend. My client is in React. My backend and the front end are hosted in two separate domains.
I am sending the session from the backend to my client using the set-...
0
votes
0
answers
42
views
Flash message is not displaying on ejs template
I want to set an error message on ejs using flash. But my message is not displaying on the page. If I use the req.session.message, it's working perfectly. When an error occurs, I am redirecting it to ...
0
votes
0
answers
12
views
middleware order confusion over an express application
I have these middlewares in the yelp app in this order (assuming order matters):
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(methodOverride('_method')...
0
votes
0
answers
48
views
In a node.js + express application, use a proxy route as middleware for another proxy
I have a node.js app with an api-gateway that routes to several microservices. One of the microservices is the authentication microservice. I want to use the route auth/verifySession to check if the ...
0
votes
0
answers
44
views
SessionID changes after each request with express server
I am currently trying to code a simple login system with express. I have a login page that sends a request to my express server which creates a new session using express-session. After that on my main ...