The basics of authentication should now be clear to you. Our task is now to implement a secure way for users to authenticate. If we have a look at our current database, we are missing the required fields. Let's prepare and add a password and an email field. As we learned in Chapter 3, Connecting to the Database, we create a migration to edit our user table. You can look up the commands in the third chapter if you have forgotten them:
sequelize migration:create --migrations-path src/server/migrations --name add-email-password-to-post
The preceding command generates the new file for us. You can replace the content of it and try writing the migration on your own, or check for the right commands in the following code snippet:
'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
return Promise.all([
queryInterface...