FB.login not working in mobile browsers

十年热恋 提交于 2020-01-02 00:33:06

问题


This is not native solution, just responsive web site.. The problem is, that FB.login simply doesn't do anything. The same goes for FB.ui methods..

i call fb init in head (but also tried in body with same results..) like this:

<script type="text/javascript">
FB.init({ 
    appId: '{$app_id}',
    status: true, 
    cookie: true,
    xfbml: true,
    channelUrl: 'https://www.nottyfly.com/channel.php',
    oauth: true
});

When user clicks fb login button, the code is like this:

function fbLogin(){ 
    FB.login(function(response) {
      if (response.authResponse) {
        FB.api('/me/permissions', function (response) {
            var perms = response.data[0];
            document.getElementById("accesstoken").value=FB.getAuthResponse()['accessToken'];
            document.getElementById("korak1").submit();                                          
            } );
      } else {
            alert('{$alert_confirm_app}');
      }
  }, {scope:'email'});  
}

This all work great at web pages, but on mobile browsers produces nothing?

ps. Here is demo web page


回答1:


This is common issue among mobile browsers and you will find that it would also be in some android devices.

For precaution it is under best practice to build flow of login manually. Go here https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow

So yes, you will need to go with manual integration. But, it will be full-proof integration without doubts.



来源:https://stackoverflow.com/questions/31248610/fb-login-not-working-in-mobile-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!