node.js 中间件_Node.js中的Passport中间件(模块)

node.js 中间件

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

嗨! 欢迎使用Node.js身份验证系列 ,我们将在其中研究和编程通行证模块或中间件

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

如今,现代Web应用程序中的一个重要工具是身份验证。 在计算的上下文中,身份验证涉及安全性。

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.

注意:您应该对Node.js,Express和HTML有基本的了解。

护照简介 (Introduction to passport)

What is Passport?

什么是护照?

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

就像任何其他npm模块一样护照是节点模块或也称为中间件。

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.

Passport非常灵活,因为它具有多种类型的身份验证方法,这可以是本地身份验证(用户名或电子邮件和密码),google,twitter或facebook身份验证,具体取决于应用程序。

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.

涉及使用Google帐户,Facebook或Twitter帐户登录的其他身份验证方法称为通行证OAuth策略 ,然后可以是使用Facebook进行身份验证的通行证-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.

与其他npm模块一样,也可以通过在命令行中运行命令来安装通行证。

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

在命令行中打开节点项目目录,然后运行以下命令: npm install password

passport module 2

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

等待一会儿,因为npm为您下载了软件包。

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

注意:您可以使用命令提示符或PowerShell作为终端。

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

感谢您与我编码! 下次见。 随意发表评论或问题。

翻译自: https://www.includehelp.com/node-js/passport-middleware-module-in-node-js.aspx

node.js 中间件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值