Skip to Content
Practical Internet of Things with JavaScript
book

Practical Internet of Things with JavaScript

by Arvind Ravulavaru
December 2017
Intermediate to advanced
296 pages
5h 56m
English
Packt Publishing
Content preview from Practical Internet of Things with JavaScript

Authorization

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Test-Driving JavaScript Applications

Test-Driving JavaScript Applications

Venkat Subramaniam
Web Caching and Replication

Web Caching and Replication

Michael Rabinovich, Oliver Spatscheck

Publisher Resources

ISBN: 9781788292948Supplemental Content