PassportJS配置文件未定义名称 [英] PassportJS Profile Undefined Name

查看:62
本文介绍了PassportJS配置文件未定义名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PassportJS 问题是未定义 profile.displayName profile.name.familyName profile.name.givenName .当我将回调与 Passport Facebook 一起使用时,完全没有问题.

The problem is that profile.displayName, profile.name.familyName and profile.name.givenName are undefined. When I use the callback with Passport Facebook, no problem at all.

使用Google帐户登录时如何获取用户名?

How to get the name of the user when using a Google account to login?

推荐答案

当我检查时,它似乎比官方样本中的参数更多,导致包括我在内的人们感到困惑.

When I checked it seems it has more parameters than what is in the official sample leading people to confusion including me..

而不是

function(accessToken, refreshToken, profile, done)

使用

function(req, accessToken, refreshToken, profile, done)

这篇关于PassportJS配置文件未定义名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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