Authentication with GraphQL
The basics of authentication should now be clear to you. Now, our task is to implement a secure way for users to authenticate. If we have a look at our current database, we will see that we are missing the required fields. To do so, follow these steps:
- Let's prepare and add a
password
field and anemail
field. As we learned in Chapter 3, Connecting to the Database, we must create a migration to edit our user table. You can look up the commands in that 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.
- Replace the content of it and try writing the migration on your own, or you can check for the right commands in the following code snippet:
'use strict'; module.exports = { up: (queryInterface, Sequelize) => { return Promise.all([ ...