Friday 30 August 2019

Using a second passport strategy using the same User model?

Hello, I started a node project some time ago using Node, Express, MongoDB and Passport using passport-local-mongoose for user auth using sessions, and my user model looks like this:const mongoose = require("mongoose"); const passportLocalMongoose = require("passport-local-mongoose"); var UserSchema = new mongoose.Schema({ username: String, email: String, password: String, //etc }); UserSchema.plugin(passportLocalMongoose); module.exports = mongoose.model("User", UserSchema); Now i want to create a react native app for the same webapp, so I want to use the same DB of users.My questions is: can I use something like passport-jwt alongside the current user model and auth strategy that I have on the website? Or do you guys recommend me to re-create the complete project using jsonwebtokens for auth only and then trying to import the current users DB?Thanks!

Submitted August 30, 2019 at 02:43PM by alejandrojsx

No comments:

Post a Comment