Skip to Content
RESTful Web API Design with Node.js 10 - Third Edition
book

RESTful Web API Design with Node.js 10 - Third Edition

by Valentin Bojinov
April 2018
Intermediate to advanced content levelIntermediate to advanced
178 pages
3h 51m
English
Packt Publishing
Content preview from RESTful Web API Design with Node.js 10 - Third Edition

Passport's basic authentication strategy

Now it is time to look at how to utilize Passport's strategies; we will start with the basic authentication strategy; it is a logical choice now that we know how basic authentication works.

As usual, we will start by installing the relevant modules with the NPM package manager. We will need the passport module, which provides the base functionality that allows you to plug in different authentication strategies, and a concrete strategy for basic authentication, provided by the passport-http module:

  npm install passport
  npm install passport-http

Next, we have to instantiate both the Passport middleware and the basic authentication strategy. BasicStrategy takes as an argument a callback function, which ...

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

RESTful Web API Design with Node.js - Second Edition

RESTful Web API Design with Node.js - Second Edition

Valentin Bojinov
Hands-On RESTful API Design Patterns and Best Practices

Hands-On RESTful API Design Patterns and Best Practices

Harihara Subramanian J, Anupama Murali, Pethuru Raj

Publisher Resources

ISBN: 9781788623322Supplemental Content