使用 OmniAuth 的正确方法是什么?在开发 Facebook 选项卡时进行设计?
我正在开发一个简单的 Facebook 应用程序,该应用程序将位于页面的选项卡中。我正在尝试找出验证用户身份的最佳方法。看起来正常的页面重定向是不正确的,这就是 OmniAuth + Devise 开箱即用的方式。如何使用 JavaScript SDK 的身份验证对话框来实现此功能?
I'm developing a simple Facebook app that will live in a Page's tab. I'm trying to figure out what the best method is for authenticating users. It seems that normal page redirection isn't right, which is how OmniAuth + Devise do it out of the box. How can I make this work with the JavaScript SDK's auth dialog?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 DMCS 所说,
FB.getLoginStatus
和FB.login
将在 JS 方面完成此操作。至于将其与 devise/omniauth 连接起来,假设您使用的是最新的omniauth,其中特定于提供者的逻辑已被分割成自己的gems,facebook-omniauth Github 页面对此进行了如下解释:现在这很好很容易。 FB.login 后,一个简单的 window.location.href = '/auth/facebook/callback' 就可以了!
As DMCS said,
FB.getLoginStatus
andFB.login
will do it on the JS side of things. As for hooking it up with devise/omniauth, assuming you're using the latest omniauth where provider-specific logic has been split out into their own gems, the facebook-omniauth Github page explains it as so:Now thats nice and easy. After the FB.login, a simple window.location.href = '/auth/facebook/callback' will do the trick!
是的,您可以使用 Javascript SDK 使其快速运行。请按照此处的示例操作: https://developers.facebook.com/docs/reference /javascript/FB.getLoginStatus/ 和 https://developers.facebook.com/docs/reference/javascript/FB.login/
Yes, you can make it work quickly with the Javascript SDK. Follow the example here: https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/ and https://developers.facebook.com/docs/reference/javascript/FB.login/