Search⌘ K
AI Features

Solution: Adding Authentication

Understand how to implement user authentication in a Deno web application by adding password checks, creating login routes, and connecting to MongoDB. Learn to handle errors gracefully and test authentication flows to secure your app.

We'll cover the following...

Task 1

Add the following check_password method in the src/users/controller.ts file:

TypeScript 3.3.4
private async check_Password(password: string, user: User) {
const hashedPassword = hashWithSalt(password, user.salt);
if (hashedPassword === user.hash) {
return Promise.resolve(true);
}
return Promise.reject(false);
}

Then make the ...