用户注册羽毛认证与护照Facebook的令牌

问题描述 投票:0回答:1

我试图让用户注册使用“用Facebook登录”我的服务。

我已经箭头1-2完成。我需要做的箭3-6。我已经在https://github.com/morenoh149/feathers-chat-facebook-signup-api最小Feathersjs例子

我似乎遇到了麻烦羽毛认证和护照Facebook的令牌生成用户对象,并邀请他们参加。我已经仔细地审核护照Facebook的令牌。 This answer解释说,在回调护照Facebook的令牌,你要创建的用户对象。如何用羽毛认证做到这一点?

当我将令牌提供在体内

curl localhost:3030/authentication \
  --data-binary '{\
    "strategy": "facebook-token", \
    "access_token": "<phone token>" \
  }'

我得到

{"name":"NotAuthenticated",
"message":"You should provide access_token","code":401,
"className":"not-authenticated",
"data":{"message":"You should provide access_token"}

当我通过令牌作为头部

curl localhost:3030/authentication \
  -X POST \
  -H "Authorization: Bearer <access token>"

我得到错误

{"name":"GeneralError",
"message":"Cannot read property 'toLowerCase' of undefined",
"code":500,"className":"general-error","data":{},"errors":{}}
node.js passport.js feathersjs feathers-authentication passport-facebook-token
1个回答
0
投票

所以,我下载并运行回购,我用VSCode运行应用程序和设置断点。我在对用户的创建之前钩创建一个断点。

这里的问题是,挂钩的gravatar预期的电子邮件是context.data,但其实它是嵌入facebook的响应中。您将需要看看从这些数据中提取电子邮件,让您可以创建一个或的gravatar只是删除的gravatar钩干脆。

© www.soinside.com 2019 - 2024. All rights reserved.