re: Building a NodeJS Web App Using PassportJS for Authentication VIEW POST


Great tutorial I was able to recreate most of it on my own web app but I am getting this error when I try to setup a new account-
Executing (default): SELECT id, FirstName, LastName, Username, Email, Password, createdAt, updatedAt FROM Users AS User WHERE = '' LIMIT 1;
Unhandled rejection Incorrect arguments


@cristiano thank you for taking time to read this article. Can you kindly send all the error output so i can help?
unhandled rejection error from sequelize can be from any number of reasons with respect to the model. make sure you are passing the right associations as it is checked against your model when you make a select/read from the db


Sure! I only get that error when setting up a new account but it actually inserts the data into the database so i moved on from it.
Now when I try to login using the credentials I used when I first set up an account, I get a Cannot Get /[object %20Response]

I've switched up the code a little so I'll show you what mine looks like. I have an ejs file with a link to the script and a button that calls the submit function :

<script type="text/javascript" src="/scripts/login.js"></script>
<button type="button" onclick="submit()" class="btn">Sign in</button>

Then the login.js looks like this:

``` function submit() {

var emailInput = document.getElementById("email").value;
var passwordInput =document.getElementById("password").value;

var userData = {
email: emailInput.trim(),
password: passwordInput.trim()

if (! || !userData.password) {

// If we have an email and password we run the loginUser function and clear the form
loginUser(, userData.password);

// loginUser does a post to our "APIlogin" route and if successful, redirects us the the members page
function loginUser(email, password) {
fetch("/APIlogin", {
method: 'POST',
email: email,
password: password
}).then(function(data) {
// If there's an error, log the error
}).catch(function(err) {

and then finally the app.js and APIlogin call looks like this respectively:'/APIlogin', passport.authenticate("local"), APIlogin);


APIlogin:(req, res)=> {


I believe this is meant for you, @cristianooo ? Looks interesting though. 😃

code of conduct - report abuse