简体   繁体   English

node.js - hapi.js facebook 集成(登录、注册)

[英]node.js - hapi.js facebook integration (login, registration)

I'm totally noob in hapi.js我完全是 hapi.js 的菜鸟

What is the best way to do login and registration via facebook with hapi framework?使用 hapi 框架通过 facebook 进行登录和注册的最佳方式是什么? Frontend will send me token, after that I need to connect again to facebook from backend and check user id.前端将向我发送令牌,之后我需要从后端再次连接到 Facebook 并检查用户 ID。

I didn't find tutorial or documentation what explain that implementation with some examples.我没有找到用一些示例解释该实现的教程或文档。

I saw lib as passport but only for express.js.我将 lib 视为护照,但仅适用于 express.js。 Is there any simple way to connect hapijs framework with facebook?有没有什么简单的方法可以将 hapijs 框架与 facebook 连接起来?

Finally I just did simple request with accessToken by axios to facebook/graph and it's work.最后,我只是通过 axios 对 facebook/graph 使用 accessToken 做了简单的请求,它的工作。

Did you integrate hapi.js with other libraries with complex communication?您是否将 hapi.js 与其他具有复杂通信的库集成? I tried to use hapijs/bell but it doesn't work for me.我尝试使用 hapijs/bell 但它对我不起作用。 Thanks for your response.感谢您的答复。

In my company, we did the FB login "from scratch". 在我的公司,我们“从头开始”登录FB。 The client send the user info in case it's a signUp call and also a accessToken. 客户端发送用户信息,以防它是signUp调用,也是accessToken。

We then check with facebook that the access token is registered with the same email than the one the client send us. 然后我们与facebook核实访问令牌是使用与客户端发送给我们的电子邮件相同的电子邮件注册的。

Last verification is that the fbId sent by the client is the same as the one we saved in the database. 上次验证是客户端发送的fbId与我们在数据库中保存的fbId相同。

It seems to me that it looks like your workflow... It is really possible that we have done something not so secured… I will check Bell in case 在我看来,它看起来像你的工作流程...我们真的有可能做了一些不太安全的事情...我会检查贝尔以防万一

@hapi/bell is your best bet https://hapi.dev/module/bell/providers#facebook @hapi/bell是您最好的选择https://hapi.dev/module/bell/providers#facebook

Try with their latest documentation and see if it works now尝试使用他们的最新文档,看看它现在是否有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM