ADVERTISEMENT
ADVERTISEMENT

Home » Node.js

Passport Middleware (Module) in Node.js

Node.js | Passport Middleware (Module): Here, we are going to learn about the passport module/middleware in Node.js with example.
Submitted by Godwill Tetah, on September 16, 2019

Hi! Welcome to Node.js Authentication Series, where we'll study and program the passport module or middleware.

Nowadays, an important tool in modern web applications is authentication. In the context of computing, authentications talk about security.

Authentication is also the verification of the identity or process which is very important in applications.

Note: You should have a basic understanding of Node.js, Express, and HTML.

Introduction to passport

What is Passport?

Just like any other npm module, the passport is a node module or also called middleware.

Hey..!!! I got you there!!! It's not the passport for traveling, but yeah it can still be understood that way based on its function. We all know without a passport, one can't travel out of the country.

Here is what the developers of the passport module say about passport:

passport module 1

Passport is soo flexible because it has many types of authentication methods which could be local authentication (username or email and password), google, twitter or facebook authentication depending on the application.

So, some applications have their own unique authentication requirement and the passport developers call then strategies.

For example, the authentication that involves signup, login, log out the form can be built using the passport local-strategy.

Other authentication methods which involve log in with google account, facebook or twitter account is called passport OAuth strategies which could then be passport-facebook which is authentication using facebook.

Well, I know you may not be familiar with them at the beginning but they're easy to understand as you work with them.

There are other hundreds of strategies which are very useful.

In my upcoming articles, we will explore several strategies and study them.

How to install passport?

Just like any other npm module, the passport is also installed by running a command at the command line.

Open your node project directory at the command line and run the command: npm install passport

passport module 2

Wait for a while as npm downloads the package for you.

Note: You can use either command prompt or PowerShell as terminal.

Thanks for coding with me! See you @ the next article. Feel free to drop a comment or question.

ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.