用户注册 feathers-authentication passport-facebook-token

User signup feathers-authentication with passport-facebook-token

我正在尝试让用户通过 "login with facebook" 注册我的服务。

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

做了一个最小的 Feathersjs 例子

我似乎无法让 feathers-authentication 和 passport-facebook-token 生成用户 object 并注册他们。我仔细查看了 passport-facebook-token。 This answer 解释说,在 passport-facebook-token 的回调中,您应该创建用户 object。如何使用 feathers-authentication 执行此操作?

当我在 body

中提供令牌时
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"}

当我将令牌作为 header

传递时
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":{}}

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

这里的问题是 gravatar 钩子应该是电子邮件 context.data 但它实际上嵌入在 facebook 响应中。您将需要查看从该数据中提取电子邮件,以便您可以创建一个 gravatar 或完全删除 gravatar 挂钩。