July 2018
Beginner
100 pages
2h 7m
English
Now that we have secured all our todo routes, we need a way to issue tokens to valid users to access the API. We will have the users send their email and password to a route (/auth), and our API will issue back an authentication token which will be used for each request:
npm install jsonwebtoken md5 --save
const jwt = require('jsonwebtoken');const Joi = require('joi');const md5 = require('md5'); ...