Skip to content
Advertisement

How to get bcyrpt compare in a promise to work right?

I’ve had this working before, but now it’s broken for some reason. I’m using MariaDB as a database, and need to compare passwords, but it’s giving me an error Unexpected Identifier on "bcrypt" after await. When I remove the await, it works, but even if the password is wrong. What am I doing wrong here? Thanks

Edit: I forgot to include the user info after .then. I must of deleted it with some comments when I posted this question. I added it back. Here is my code:

JavaScript

I tried Lucas suggestion, and got this error:

JavaScript

Any other ideas?

Advertisement

Answer

I was able to resolve this by putting a “async” in front of rows. This seems strange to me, and I don’t know if this is normal, but it works.

Here’s my final code from what I modified:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement