June 17, 2023, 5:48 p.m. | Mustafa Resul Çam

DEV Community dev.to




You can do it by having 2 different LocalStrategies to authenticate user and admin differently (in your case from different tables).


Something like :


passport.use('user', new LocalStrategy(  //'user' strategy
function(username, password, done) {
User.findOne(/* ... */)
}
));

passport.use('admin', new LocalStrategy( //'admin' strategy
function(username, password, done) {
Admin.findOne(/* ... */)




case dec function passport password strategy tables username

Social Engineer For Reverse Engineering Exploit Study

@ Independent study | Remote

Cyber Security Culture – Communication and Content Specialist

@ H&M Group | Stockholm, Sweden

Container Hardening, Sr. (Remote | Top Secret)

@ Rackner | San Antonio, TX

GRC and Information Security Analyst

@ Intertek | United States

Information Security Officer

@ Sopra Steria | Bristol, United Kingdom

Casual Area Security Officer South Down Area

@ TSS | County Down, United Kingdom