All Questions
364
questions
0
votes
1
answer
46
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
0
answers
14
views
passport js middleware will always redirect me to the faliure route
please help me find the issue with my passport.js setup i swear i will never use passport again just please help me this time
passport.js
const passport = require('passport');
const mongoose = require(...
0
votes
1
answer
29
views
i m traying to update user profile information Database
enter image description hererouter.post('/profile/update', isLoggedIn, function(req, res, next) {
const userId = req.user._id;
userModel.findById(userId, function(err, user) {
if (err) {
return next(...
0
votes
1
answer
20
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 ...
0
votes
0
answers
16
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
//...
0
votes
1
answer
46
views
How to authenticate user, using PassportJS using local strategy during user registration?
I'm following a Udemy Course and in that there is this section where the tutor saves the user to mongoDB, using passport-local-mongoose, and after saving there is an Authenticate function which it ...
0
votes
0
answers
39
views
How do you store a login session to be used in another route node express passport jwt mongoose
I'm trying to build a route that will allow the logged in user to change their password. I have a register new user and login route that is working alright, but I don't know how to store that token ...
0
votes
0
answers
22
views
Why am I seeing "bad request" when I run my code using nodemon app.js?
**this is my app.js code: **
import dotenv from "dotenv";
import express from "express";
import bodyParser from "body-parser";
import ejs from "ejs";
import ...
0
votes
0
answers
10
views
Passport.js local strategy. How to avoid direct-typing-in-the-address-bar access to the protected route?
This is my app.get:
app.get('/secrets', async (req, res) => {
if (req.isAuthenticated) {
try {
const foundUsers = await User.find({'secrets': {$ne: []}});
res.render('secrets', {...
0
votes
1
answer
43
views
"done" function isn't working after moving from callbacks to promises for mongoose query
I am trying to reconfigure some code because mongoose no longer allows for callbacks. However, although I can find a user with findOne(), I am having trouble passing that user back to routes.js for ...
0
votes
1
answer
150
views
Buliding an Organization Structure
MY application is build With Nodejs , Atlas Mongodb DB and Express
for user Authentication Im using PassportJS.
for the DB connection I Use Both Mongoose and MongoClient
Im Looking forward to Split my ...
1
vote
1
answer
95
views
What would the new way of passport deserialization look like?
In am following a simple MVC tutorial https://blog.logrocket.com/building-structuring-node-js-mvc-application/ to build a login authentication system.
Till a few days back, I had a working serialize ...
0
votes
1
answer
345
views
Passport seem to not set properly req.user after initialization
I use Mongoose (connected to a mongoDB atlas cluster), ExpressJS, and NodeJS to make a login/authentication system but after login and initialize with Passport, req.user doesn't return the user info ...
0
votes
4
answers
2k
views
throw new MongooseError('Query.prototype.exec() no longer accepts a callback'); MongooseError: Query.prototype.exec() no longer accepts a callback
i am trying to register and authenticate user using passport.
registration form is working fine
throw new MongooseError('Query.prototype.exec() no longer accepts a callback');
^
...
1
vote
0
answers
66
views
Serializing and Deserializing other than user model
I have two schemas one for farmers and other for users but when serializing it is not working..
when in the registered all of the data goes to the Users model
const farmerSchema = new mongoose.Schema({...