December 2017
Intermediate to advanced
296 pages
5h 56m
English
Next, we are going to look at out-of-the-box auth. We will be using JSON Web Tokens (JWTs) to authenticate the clients that are going to communicate with our API engine. We will be using Passport (http://passportjs.org/) for authentication.
Open api-engine/server/auth/index.js and we should see the Passport setup using require('./local/passport').setup(User, config); and we are creating a new route for authentication.
The routes are configured in api-engine/server/routes.js. If we open api-engine/server/routes.js, we should see app.use('/auth', require('./auth'));. This will create a new endpoint named /auth and inside the api-engine/server/auth/index.js, we have added router.use('/local', require('./local')); now, if we wanted ...