Passport-google-oauth和passport-google-token有什么区别? [英] What is the difference between passport-google-oauth and passport-google-token?

查看:42
本文介绍了Passport-google-oauth和passport-google-token有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Google验证我的节点应用程序.但是我发现这两个模块在不同的教程中使用.您能告诉我两者之间的区别吗?

I am trying to validate my node app using google. But I found these two modules being used in different tutorials. Could you please tell what the difference is between these two.

passport-google-token

在两者的npmjs.com页面上,我发现desc作为Passport策略使用OAuth 2.0 API使用Google访问令牌进行身份验证.该模块可让您在Node.js中使用Google进行身份验证应用程序.通过插入Passport,可以进行Google身份验证轻松,毫不费力地集成到任何应用程序或框架中支持Connect风格的中间件,包括Express.

On the npmjs.com page of both, i found the desc as Passport strategy for authenticating with Google access tokens using the OAuth 2.0 API. This module lets you authenticate using Google in your Node.js applications. By plugging into Passport, Google authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

passport-google-oauth

使用OAuth 2.0向Google进行身份验证的护照策略.

Passport strategies for authenticating with Google using OAuth 2.0.

主要维护者:David Pate

Lead Maintainer: David Pate

该模块可让您在Node.js中使用Google进行身份验证应用程序.通过插入Passport,可以进行Google身份验证轻松,毫不费力地集成到任何应用程序或框架中支持Connect风格的中间件,包括Express.

This module lets you authenticate using Google in your Node.js applications. By plugging into Passport, Google authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

推荐答案

passport-google-oauth 是为快速应用程序制作的,因此您可以配置权限,回调uri并请求用户数据,所有操作都在在同一个地方.

passport-google-oauth was made for express apps, so you can configure permissions, callback uri and request user data, all in the same place.

passport-google-token 是为REST API设计的,因此您可以在前端处理身份验证逻辑,然后将google令牌发送到后端(节点服务器),在那里您可以使用Google令牌请求用户数据,并使用您自己的身份验证机制(JWT,无记名令牌等)授予对您应用的访问权限.

passport-google-token is made for REST APIs, so you handle authentication logic in front-end and then, you send google token to the back-end (node server) and there you can request user data using google token and grant access to your app using your own authentication mechanism (JWT, Bearer Token, etc.).

这篇关于Passport-google-oauth和passport-google-token有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆