All Questions
Tagged with node.js passport.js
5,441
questions
0
votes
0
answers
13
views
Can't set cookies with passport google oauth
I am using Passport's GoogleAuth20 to login. I can login successfully but in callback function can't set any cookies.
This is my callback function after authentication:
exports.googleCallback = (req, ...
-1
votes
0
answers
21
views
passportjs + googleoauth20 + express-session (valkey store optional) req.user undefined
I'm so tired i spent the whole day trying to fix it but no matter what i do it's not working all i get is undefined PLEASE PLEASE HELP!!!!
I Uploaded All The code On GitHub
https://github.com/Parag-47/...
-1
votes
1
answer
27
views
CRUD operation problems in NODEJS and MONGODB [closed]
How to prevent duplicate ID and email in mongodb, nodejsand expressjs. and stop registration. also prevent the user from registring twice. Iam just new in nodejs and mongodb i will appreciate if i can ...
0
votes
0
answers
14
views
Set-Cookie is working in Localhost but not on the deployment
When i use my localhost login endpoint, i can see that Set-Cookie header is working and it is giving me value, but when im using my deployed login endpoint, i cant find the Set-Cookie in the response ...
0
votes
1
answer
47
views
Is this a valid approach to password reset
I'm currently building a password reset flow and wanted to check this made sense.
So the user would make a request passing their email which would generate a token, this would be sent to the user and ...
1
vote
1
answer
21
views
Passport JS authenticates if the user goes back on navigation history even without selecting account
When the user have logged In the app before(gave consent), in the next time while logging in the user can be authenticate without even selecting the account. How to prevent it? Bug occurs on step 2:
...
0
votes
0
answers
18
views
Problems with React Native Google Sign-in With Passport in NodeJS API
I have a NodeJS API that handle user authentication with username/password and google. Both work perfect on web browser or postman, but i cant make it work in react native.
Here's the code that handle ...
1
vote
1
answer
81
views
NestJS multitenancy with Passport JWT not working, Request object is undefined
I have created a multitenant app in NestJs using a connection factory where we inject a connection for each request. I have spent several days debugging this but no luck till now.
Github repository: ...
1
vote
0
answers
19
views
OAuth working on localhost and production in Chrome, but not Firefox / Safari
I am quite new to web development, so please bear with me!
I have deployed a React application (famtivity.fun) via Netlify with my backend hosted on Heroku (here).
Initially, Oauth for Google / Github ...
1
vote
0
answers
17
views
How to implement login and registration module in node and react with passportjs
I want to know like there is a three pages login registration and home now I want like before signup or sign in user should not be able to access home page now how to implement that like normally and ...
0
votes
1
answer
33
views
passport.deserializeUser function never getting called
Passport's deserialization just does not work no matter what I do. This is my passport.js:
const passport = require('passport');
const GoogleStrategy = require('passport-google-oauth20').Strategy;
...
0
votes
0
answers
33
views
NPM passport issue
I am using NPM package passport
router.get("/login", (req, res) => {
res.render("users/login.ejs");
});
router.post(
"/login",
(req, res) => {
...
0
votes
1
answer
30
views
Login Redirection Issue in Express.js with Passport Authentication
I am developing an Express.js application and facing a persistent issue with user authentication. Despite successful user registration and confirmed entries in the database, the login process does not ...
0
votes
0
answers
24
views
Why is my Google social login working despite my app not being published?
I have implemented Google social login for my web application. Here are the steps I've taken so far:
Created an OAuth 2.0 Client ID in the Google Cloud Console.
Added my application's domains under &...
0
votes
0
answers
40
views
passport login issues in session
I'm having trouble with my passport. The login process went through without any issues, but the passport key has to be saved into the session and there is not req.user in the requset
the initapp ...
0
votes
1
answer
28
views
How do I specify which HTTP method should be used in a redirect in my express application?
I have a NodeJS/Express application where I am using PassportJS for authentication.
I have the following routes:
router.get("/profile", isUser, (req, res) => {
res.render("profile&...
0
votes
0
answers
34
views
How to Configure Google Auth Redirect URI for a Node.js Application on AWS EC2?
I'm currently deploying a Node.js application that uses Google OAuth 2.0 for authentication on an AWS EC2 instance. However, when users attempt to log in using Google, they receive an "access ...
0
votes
1
answer
103
views
Getting "401 Unauthorized" when accessing protected route in Express.js with express-session and passport
I'm building a blob web application using Express.js where users can log in and access protected routes. I've set up session management using express-session and authentication with passport-local. ...
0
votes
1
answer
37
views
Cookie not setting in Express with Passport JS
I am using Passport JS for authentication for my MERN app. I am trying to have routes that are protected so you must be authenticated. When I test the routes and /login in Thunder Client and then try ...
0
votes
1
answer
51
views
Mongoose CastError: Cast to ObjectId failed for Twitter ID (type string)
I’m working on a content syndication project where I’m implementing Twitter authentication using Passport.js and Mongoose. The authentication flow works up to the point of deserializing the user. I’m ...
0
votes
1
answer
46
views
Login route returns "Cannot POST /login" - implementing Passport in MERN
I am trying to implement Passport into my MERN application, registering users and all other routes work but whenever I hit the /login POST route I get Cannot POST /login (see image below). This only ...
0
votes
0
answers
26
views
NODE + PASSPORT + GOOGLE STRATEGY: req.user not being persistent and connect.sid not being sent in production environment
I'm working on a MERN stack project and I'm facing this issue where my req object is not being persistent and holding the req.user after it has been authenticated. when the /google/callback enpoint is ...
0
votes
0
answers
61
views
Google OAuth Refresh Token Undefined
I realize that this has come up several times, but I have tried every solution I could find, and my refreshToken is still coming up as undefined.
I make sure that I delete my app's 3rd party access.
...
0
votes
1
answer
36
views
Express request does not inlcude user after passport (local strategy) authentication
Question: I try to authenticate http requests via username and password. The authentication seems to work. But for some reason the user data is not available inside the express routes. Related ...
0
votes
1
answer
32
views
Passport JS and express-session: req.isAuthenticated() false in production , returns true in development
I am responding to request from client for protected resources based on whether the req.isAuthenticated() flag returns true or false
I am hosting my app on render
When i had completed the initial ...
0
votes
0
answers
72
views
Keep getting TypeError: Cannot set properties of undefined (setting 'user')
I'm new to Nodejs and Express server. I'm trying to create a webapp where user can log in with their Gmail. My front-end uses Reactjs. However, I keep getting this error TypeError: Cannot set ...
0
votes
0
answers
39
views
session being overwritten using node js express passport authentication oath2 session for google
Google suggests to ask a user for a minimal set of permission when first signing up a user, and to then ask to extend those permissions when/if needed by the user. So, I have used token based ...
0
votes
0
answers
37
views
nock is not intercepting HTTPS request to Keyclaok
I have been struggling in the last two days to figure out what is not working well with my nock setup.
Description:
I work with node environment and express as the application server.
The ...
0
votes
0
answers
22
views
React.js Passport.js session and cookie problem
That's my db session also passport.js configuration in index.js file:
const connect = async () => {
try {
await mongoose.connect(process.env.DB_URL);
console.log("Connected ...
0
votes
0
answers
22
views
Trouble Obtaining Refresh Token Alongside Access Token from Dropbox OAuth2 in Local Environment
I'm trying to integrate Dropbox into my web application using OAuth2. My code seems to be working correctly, but I'm only receiving the access token and not the refresh token upon successful login. I'...
0
votes
0
answers
12
views
can someone explain how serializeuser deserializeuser work here with google login and normal login
why when someone not logged in with google tries to post something the req.user gives the google id only but when its a user thats not logged in with google the req.body gives the id and the username ?...
0
votes
0
answers
21
views
passport serialize/deserialize user google login problem with googleid and normal id
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
31
views
The user registers he's authenticated but cant get to the secret page so it redirects me to the login always
I do not actually know where the problem is but what i think is in either the secrets route or register route.
I want in that if the user registers the cookie is saved with the session id and the user ...
1
vote
0
answers
17
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
0
answers
13
views
Backend says isAuthenticated is true/ frontend says isAuthenticated is false
Im using passport js google oauth20. Upon fetching from the backend and console.logging the data I get false. I'm not sure what's causing this
Frontend
const [isauthenticated, setIsAuthenticated] = ...
1
vote
0
answers
104
views
Credentials problem in Vite.js application (passport.js)
When I send POST request from Vite.js app (localhost:5173) to backend I get correct response but my data doesn't come. I mean My request goes correctly but the data is not coming
Hello, first of all ...
0
votes
0
answers
27
views
passport-google-oauth20 redirect and replace history
I have setup a simple authentication flow with google using passport-google-oauth20.
Basicly I added a separated file to handle the initial configuration like represented bellow:
const GoogleStrategy =...
0
votes
0
answers
32
views
Passport.js JWT Typescript Conflict with req
middleware:
import { Response, NextFunction } from 'express';
import { Role } from '@prisma/client';
import { IUserRequest } from '@/interfaces/custom-request.interface';
export const verifyRoles = (....
0
votes
1
answer
31
views
InternalOAuthError: Failed to fetch user profile with Passport.js LinkedIn Strategy
I'm trying to implement LinkedIn authentication in my Node.js application using Passport.js and the passport-linkedin-oauth2 package. After a successful login redirect, I'm encountering the following ...
0
votes
1
answer
20
views
I am getting a "Bad Request" while login using my nodejs server but i am confused why i am getting this error. I am quite new to nodejs
passport.use(new LocalStrategy(async(email,password,done) => {
try{
const user = await User.findOne({email:email})
if(!user){
return done(null,false,{message:"Invalid email&...
0
votes
0
answers
23
views
oauth and manuall authentication in node.js
alright, I have a page where users can register using name, email, and password then log in using email and password, now I also want to authenticate using Google Oauth login, so how will that work ...
2
votes
1
answer
37
views
Why check both req.isAuthenticated() and req.user in Passport Oauth 2.0 authentication?
Why check both req.isAuthenticated() & req.user for authentication in Passport Oauth 2.0? I believe req.isAuthenticated() alone is enough for social sign-in. I see others using both, but I don't ...
1
vote
0
answers
18
views
Redirecting to different routes according to user type
This is my express code, I'm handling authentication by passport.js and passport-local-mongoose, I've been having trouble redirecting different user type to their dashboard
var express = require("...
0
votes
0
answers
28
views
PassportJS login problem with failureRedirect: '/auth/login'
I have a project where I am making a login system with passport.
I use nodejs and mysql. What happens is when i enter info and press login, it just failureRedirect: '/auth/login' without any logs.
...
0
votes
0
answers
50
views
how to get a callback from discord desktop app
I am developing this web application that has a login to the workspace but after the user logs in successfully I want to make sure that he is running the discord app installed on his pc and is logged ...
0
votes
0
answers
21
views
Passport-Discord dynamic uri
soooo basically im making this because in my code i dont want the discord auth (/auth/discord/callback) to try to redirect me to localhost:8080. Because the domain would be dynamic because this will ...
0
votes
0
answers
22
views
Passport.js successRedirect doesn't load page, request keeps pending in signUp form
Im trying to write signUp proccess with passport.js local-strategy and it works and save user data in dataBase but it doesnt redirect me and keeps pending while the failureRedirect works well the ...
0
votes
0
answers
29
views
The "local" function in passport.authenticate is not being invoked for some reason
const express = require('express');
const jwt = require('jsonwebtoken');
const passport = require('passport');
const localStrategy = require('passport-local').Strategy;
const router = express.Router()...
0
votes
0
answers
19
views
Unable to save session with passport.js after signing up
So, I am learning passport.js, everything seems to be working fine until, signing up a user.
NOTE: I am just playing with json-server now, so no db.
app.post('/signup', async (req, res) => {
...
0
votes
0
answers
68
views
Implementing a login system using react and passport local
Im currently trying to set up a login authentication for react using a passport local strategy.
Here is the code:
The authentication code:
const passport = require('passport')
const {Strategy} = ...