自动调用Facebook登录用户的Facebook页面选项卡上的FB.login [英] Automatically invoking FB.login on Facebook page tab app for non-logged in user

查看:233
本文介绍了自动调用Facebook登录用户的Facebook页面选项卡上的FB.login的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Facebook页面标签应用程序。对于未登录的用户,我想:




  • 检测用户是否未登录

  • 如果没有登录,自动指示用户登录



我目前的方法是使用FB Javascript SDK(优先于服务器身份验证流程):




  • 在页面加载时,运行 FB.getLoginStatus 检查用户状态

  • 如果用户未登录,请运行 FB.login 以调用OAuth对话框



问题:




  • FB.login 创建一个弹出对话框(更喜欢页面选项卡iframe中)

  • 如果 FB.login 不是从一个按钮调用(我真的想避免让用户点击一个按钮;所以真的很想自动调用它,当我发现没有登录的用户)


解决方案


我真的很喜欢id有用户点击按钮


FB.login没有用户交互 - >阻止弹出


喜欢页面选项卡iframe


Auth对话框在如果自动调用登录对话框是您最重要的要求,则使用JavaScript重定向到认证对话框URL,然后重定向回到您的页面/应用程序Facebook地址。请参阅没有JS SDK的客户端验证一节: https://开发人员。 facebook.com/docs/authentication/client-side/


I have a Facebook Page tab app. For a user who is not logged in, I want to:

  • Detect if user is not logged in
  • If not logged in, automatically direct user to login

My current approach is to use FB Javascript SDK (in preference to server-side authentication flow):

  • On page load, run FB.getLoginStatus to check user status
  • If user is not logged in, run FB.login to invoke OAuth dialog

Problem:

  • FB.login creates a pop-up dialog (prefer if within Page Tab iframe)
  • This pop-up dialog is blocked if FB.login is not invoked from a button (I would really like to avoid having the user click a button; so would really like to invoke it automatically, when I find a user that is not logged in)

解决方案

I would really like to avoid having the user click a button

FB.login without user interaction -> blocked popup

prefer if within Page Tab iframe

The Auth dialog won’t work inside an iframe, it’s designed that way.

If the automatic call of the login dialog is your most important requirement – then use JavaScript to redirect to the Auth dialog URL, and redirect back to your page/app Facebook address afterwards. See section "Client-side authentication without the JS SDK" here: https://developers.facebook.com/docs/authentication/client-side/

这篇关于自动调用Facebook登录用户的Facebook页面选项卡上的FB.login的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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