Questions tagged [passport.js]

Passport.js is authentication middleware for Node.js. Extremely flexible and modular, Passport can be unobtrusively dropped into any Express-based web application. A comprehensive set of strategies support authentication using a username and password, Facebook, Twitter and more.

Filter by
Sorted by
Tagged with
0 votes
1 answer
14 views

Passport authentication showing unauthorized in node.js after registering the data successfully in my database?

I have made a register route with a docSchema registration using the register function of the class. Now the problem is that upon registering on the frontend it does not throw any error but rather ...
Aman Tyagi's user avatar
0 votes
0 answers
19 views

Promise returned in function argument where a void return was expected, passportjs

I'm currently trying to implement a basic google uauth2 with passport.js, this is the function I'm trying to rewrite/adapt to mongoose function verify(accessToken, refreshToken, profile, cb) { ...
Dudu Dudu's user avatar
  • 177
0 votes
0 answers
8 views

Passport.js - Chrome will not allow cross-site cookies

My frontend is hosted in (example.com) and backend in (api.example.com). This counts as cross-origin and I'm using Passport.js with Redis for sessions (with cookies). However, this Google Chrome ...
Meli Fetaji's user avatar
0 votes
0 answers
8 views

Google auth not working on production , but working perfectly on localhost

Implemented Google auth strategy using passport.js on Node.js . It works perfectly fine on localhost but when I try on deployment it keeps on giving me URL_MISMATCH . even when i have correctly put ...
Mayank Johari's user avatar
0 votes
0 answers
14 views

How do I send i send an gmail api request- i did all the authentication steps but i hit a wall

I am trying to construct a Gmail replica but I've hit a roadblock in terms of making requests to Gmail API- here's my code: index.js const express = require("express"); const cors = require(&...
acorn's user avatar
  • 1
0 votes
0 answers
13 views

NodeJS & Passport.js - Cookie expiring before set time

I have implemented AUTH with Passport.js using Redis as session storage. Everything works well but for some reason, the cookie expires much earlier than the set time (if the website is not open/active ...
Meli Fetaji's user avatar
0 votes
0 answers
12 views

express-session error "refused to execute script from because its mime type..." without express.static('public')

I am new to express and was building a basic test of the passport js local strategy. I was receiving the following message in the console of home.html after successful authentication: "Refused to ...
Gordon's user avatar
  • 5
0 votes
0 answers
11 views

NestJS + Passport-steam: Failed to discover OP endpoint URL

I am using passport-team as my Strategy in my NestJS application. Everything was working fine yesterday but today I'm getting this error: InternalOpenIDError: Failed to discover OP endpoint URL This ...
igniss.'s user avatar
  • 73
0 votes
0 answers
16 views

problems with cookies with express-session node.js

i deploy my api in fl0 and use the free url from fl0 and deploy my frontend in vercel, the problem is that cookies doesnt save in the client, my configuration of express-session is: const store = ...
MatuGlz's user avatar
0 votes
0 answers
12 views

facing error in passports login method its saying user not defined

import express from "express"; import bodyParser from "body-parser"; import mongoose from "mongoose"; import session from "express-session"; import passport ...
Swaraj Gaikwad's user avatar
0 votes
0 answers
21 views

Unable to set cookie in cross-domain environment using Express cookie-session and passportjs GitHub OAuth2

I have an app with react frontend and express backend implementing passport.js GitHub OAuth2 + cookie-session workflow. The res.on("close") listener recorded that while in development with ...
Nia_H's user avatar
  • 1
0 votes
0 answers
20 views

passport add paramaters to request with nestjs javascript

I'm doing an application and I'm using "NestJS" for the back. In my application, I have a button that allows the user to connect his Spotify account (using passport). For the moment, when ...
Alexandre Boucard's user avatar
0 votes
0 answers
13 views

Unable to get token values from passport-openidconnect

I am developing a NestJs application that acts as a Proxy Server. My first task was to integrate Okta Single Sign On into our application. In order to do that, I went with a passport strategy '...
dodoDuck123's user avatar
0 votes
0 answers
15 views

Redirecting in Node.Js

The page is not redirecting after successful or unsuccessful login. I am using MVC architecture using express generator. Here is my code: exports.log_in_get = asyncHandler((req, res, next) => { ...
Arun Sankar's user avatar
0 votes
0 answers
9 views

microsoft login fails with passport

I use this code const passport = require('passport') const OAuth2Strategy = require('passport-oauth2').Strategy const config = require('@arades/devonso-core/config') passport.use('azuread-...
Saleh Rezaei's user avatar
0 votes
0 answers
29 views

Whoop API Error when trying to login with passport and OAuth 2.0

Hi I'm trying to make a log in using whoop api, currently they use passport and OAuth2.0, but it seems that it gaves me an error when i do the passport.authenticate in the callback endpoint. This is ...
Pere Tarrida Domingo's user avatar
0 votes
0 answers
13 views

Passport-local-mongoose not working for login after successful signup

I am using passport -local mongoose for authentication. Everytime I am successfully able to signUP the user but when I try to log in with the same id password, wrong username password error pops up //...
Kartic Joshi's user avatar
0 votes
0 answers
27 views

NestJS Passport Local ends up never responding

I'm trying to implement authentication system described in https://docs.nestjs.com/recipes/passport using Passport Strategies and Guards. When I use AuthGuard('local') to validate and issue jwt tokens ...
Togrul's user avatar
  • 144
1 vote
0 answers
27 views

Passport.js Google OAuth: Best Practices for Handling and Customizing Error Responses

I'm working on implementing Google OAuth authentication in my Node.js application using Passport.js. I have set up a custom error-handling middleware to handle authentication errors, but it's not ...
Roni Jack Vituli's user avatar
1 vote
0 answers
13 views

"errorMessage":"Cannot find module 'C:\\Users\\vickey\\Downloads\\RFREARN_BACKEND\\RFREARN_BACKEND\\routes\\passport-config'

Description: I'm encountering an issue with my Node.js/ESM project running on AWS Serverless Architecture. The error message indicates that it cannot find the 'passport-config' module. I've thoroughly ...
Vikas Kuntal's user avatar
1 vote
0 answers
78 views

Why do I have to decodeURIComponent the cookie in my session in order for it to work with passport & express-session? [duplicate]

I've recently been building a social media app and I'm using Next.js app router on the client-side with express-session cookie-based auth and passport. The way that my server-side code is structured ...
yungdino's user avatar
0 votes
0 answers
16 views

Callback not redirecting to success route

I'm using two passport strategies for authentication local and google, the local strategy works fine, but for Google I get the Sign-In Popup. I choose the account already listed in the test users, the ...
ahmad redouane echberaal's user avatar
0 votes
0 answers
11 views

Why can't I start my web server after trying to import passport?

I'm trying to substitute my manual auth login route in my web app for Passport local authentication. I can't start my web app as it says passport.initialize() is not a function. If I move it down then ...
João Cardoso's user avatar
0 votes
0 answers
7 views

req.isAuthenticated always return false in passport js - nodejs

When I call req.isAuthenticated() in my local login strategy upon successful login, it always returns true as it should. However, when I try to call req.isAuthenticated in any other file/route in my ...
salil chaudhary's user avatar
0 votes
0 answers
17 views

Passport local is saving 3 documents in MongoDB

I am having an issue with a single request (can see logs confirming it) to my Node.js application that uses Express.js and Passport.js's local strategy where when I sign up a new user it will save 3 ...
joshk132's user avatar
  • 1,011
0 votes
1 answer
23 views

Passport JS Google OAuth20 Strategy Typescript Error

I'm currently migrating a passport JS Google OAuth2 strategy from JavaScript to TypeScript and I'm receiving the a TypeScript compile error. The clientID and ClientSecret fields are highlighted as ...
Bry's user avatar
  • 153
0 votes
0 answers
17 views

How to implement token access in cookie and token refresh in local storage using Passport and Node

I'm not senior in Node/Express/Passport and here is what I currently have set up on my application I have a LocalStrategy on my Login request that allow me to connect with email and password. passport....
user16916431's user avatar
0 votes
0 answers
9 views

Nestjs access control cannot read roles

so I have a nestjs application with session authentication that I set to session by role. Then I followed one of other people's tutorials or repositories like this: https://github.com/vladwulf/cwv-...
Haru-Kazumoto's user avatar
0 votes
0 answers
30 views

Problem with Google strategy (Passport.js + MERN)

I am developing a MERN project with friends where we have installed Passport. We created our local strategy that works well but then we decided to go further and try to do something else using Google'...
VPAR261's user avatar
  • 37
-2 votes
0 answers
37 views

Error: Unknown authentication strategy "google"

Here are output result: Error: Unknown authentication strategy "google"    at attempt (C:\\Users\\Biswadeb\\Desktop\\Test\\node_modules\\passport\\lib\\middleware\\authenticate.js:193:39)    ...
Biswadeb Rajbongshi's user avatar
0 votes
0 answers
10 views

Installing passport strategy for node application results in npm warnings

I want to use the passport magic link for my project but get two depreciation warnings: npm WARN deprecated @babel/[email protected]: 🚨 This package has been deprecated in favor of separate inclusion ...
nick_jj's user avatar
  • 19
0 votes
0 answers
17 views

Shift an existing passport authentication to AWS cognito in nestjs

I have an existing nest application, built with postgres and typeorm, I have used passport for authentication, I have also used passport strategies for social login with google, facebook, github and ...
Sayyed Mohammad Maroof's user avatar
1 vote
1 answer
40 views

Cant access protected resources even after successful login ( passport oauth2.0 google sign in )

Facing Trouble making protected Resources accessible to Logged in users ( oauth2 google passport.js ) I am able to login and then get redirected to the protected page ( on the frontend). But when the ...
Saradh Savyasaj's user avatar
0 votes
0 answers
16 views

passport redirect url gives internal server error when called twice, nestjs, passport

I'm using nestjs and trying to add a discord login, i use passport and guards and until now i understand that when i call the login controller @Get("discord/login") @UseGuards(...
SPHINX's user avatar
  • 1
0 votes
0 answers
16 views

Passport sign in with Google: No 'Access-Control-Allow-Origin' header is present on the requested resource

Access to XMLHttpRequest at 'https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A6046%2Fauthorize&scope=profile&client_id=723881342981-...
Saradh Savyasaj's user avatar
0 votes
0 answers
12 views

MultiSamlStrategy in NestJs

I see that passport-saml provides multi saml strategy to use as following (reference). const { MultiSamlStrategy } = require('passport-saml'); passport.use(new MultiSamlStrategy( { ...
Anonymous Creator's user avatar
0 votes
1 answer
19 views

Error when using Passport.js isAuthenticated() function

I'm just doing some testing as I write some endpoints on my server, and I noticed something really weird. here are some test endpoints I wrote: function ensureAuthenticated(req, res, next) { if (req....
sweglord's user avatar
0 votes
0 answers
20 views

isAuthenticated is always false after callback redirect to react localhost on a different port 3000 . Passport.js + React + Express.js

User is successfully authenticated with Passport.js strategy but after callback redirect to React frontend running on different port, req.isAuthenticated is always false. Might be Cors issue in React +...
Vitali Kotik's user avatar
0 votes
0 answers
21 views

Why is express-session not setting the cookie to my Remix app in the frontend?

Backend is not setting the cookie on the frontend. I expected to see a cookie with the name 'connect.sid' but no cookies are found. Whenever I attempt to authenticate, the backend (Node) throws a 401 ...
Arizzu's user avatar
  • 1
0 votes
0 answers
56 views

Google authentication with passport in node.js. How to generate my own jwt token after successful login?

Here are all the resources I've based to build my solution/strategy for this: https://medium.com/free-code-camp/how-to-set-up-twitter-oauth-using-passport-js-and-reactjs-9ffa6f49ef0 https://medium.com/...
Rafael Santos's user avatar
0 votes
0 answers
12 views

Use token but alert unauthorized

I use the express,passport,jwt to achieve restricted access using tokens. The login interface generate token suceessfully,but when I use getKind interface whith rigth token,it alert me unauthorized. ...
Centaurea's user avatar
0 votes
0 answers
11 views

When using google passport 2.0 for Oauth the "done" callback is returning global error handler error

When i do a get request to the google oauth i am sent to the proper google oauth screen. then when i click on a google account to log in with i hit the global error handler. it is getting caught in ...
Will's user avatar
  • 1
0 votes
0 answers
24 views

Is there a way for CONNECT-PG-SIMPLE to automatically remove expired sessions in DB?

I am trying to fully understand the authentication flow for Node/Express, PasspostJS, and Postgres from a basic side-project. Logging in from the App creates a cookie that expires in 1 day in the ...
rozeluxe08's user avatar
0 votes
0 answers
17 views

Do I need to check, if user is authenticated when using passport.authenticate()?

Using JWT auth in Passport.js. I have an endpoint, where I need to ensure, if user is authenticated router.get('/', passport.authenticate('jwt', {session: false}), (req, res) => { if (!req.user)...
Sanyokk's user avatar
  • 43
0 votes
0 answers
15 views

req.isAuthenticated() sometimes false when deployed to vercel

My application works as expected when I run on my localhost. But after deploying in vercel i counter this error. When log in is successful and i see the secrets page, when i try to access the account ...
Aleniere's user avatar
0 votes
0 answers
23 views

Passport js while deserializing users returns null

So I used passportjs for authentication and it worked fine for a while but now all of a sudden it is giving null while deserializing users even though the user with provided id is present in the ...
B1 FOOTBALL's user avatar
0 votes
2 answers
103 views

Should I query the database for the JWT user in the middleware in Express.js?"

I have a Node.js application where I'm using Passport.js with JWT strategy. After providing a JWT to the client, the user may become a canceled user. However, since they obtained the JWT beforehand, ...
Nurettin Şen's user avatar
0 votes
0 answers
29 views

Azure passport multi-tentant app can't access federation metadata

Converting a single tenant app to multi tenant. Is it possible to protect this with passport authentication using an Azure access token? It works fine for single tenant app. Here is the main code from ...
b.b.89's user avatar
  • 111
0 votes
1 answer
25 views

How to set cookies inside passport-google-oauth callback?

I attempted to set a cookie from express app when the authentication of google oauth is successful. I've followed every steps in the documentation and it worked well in development environment. ...
Ngr Wisnu's user avatar
0 votes
0 answers
23 views

How to redirect a user to chrome extension tabs page from NodeJS?

I'm working on an extension (MV3) and I'm using Passport.JS to authenticate users with Google. I'm using JWT which I need to send to the frontend. When I try to use the following code to redirect the ...
Ankit Sharma's user avatar

1
2 3 4 5
140