首页 > 解决方案 > 模式中的 FB.login 未打开弹出窗口

问题描述

我们现在在应用程序上使用社交,但我们在 facebook 模式中遇到问题。

简而言之,用户浏览到一个 facebook 群组并使用自定义按钮,我们打开一个包含我们应用程序的 URL。

问题在于:

  1. 如果在用户单击“FACEBOOK LOGIN”时在全屏浏览器中打开 URL(由于平台规范或版本),则会显示登录模式,但是
  2. 如果在 FB 模式中打开 URL(如在某些 iOS 版本中),则不会显示任何模式,并且由于登录到 facebook 应用程序(在这种情况下 - 不可调试)而无法调试该模式

有人有同样的问题吗??

提前致谢

编辑

我还附上了代码功能:

function fbLogin() {
    $$Loader.start();

    Service.getFBAppID().then(
        function(res) {
        if (res) {
            $$FBAuthz.init(res).then(function() {

            // Try to show to the user FB login mask
            FB.login(function(res) {
                if (res.authResponse) {
                var token = res.authResponse.accessToken;
                $log.debug("INTRO: FB credentials valid. Fetching informations");

                // User authenticated successfully on FB
                // Try now to authenticate user into GoWeb system
                $$User.login(null, null, {
                    accessToken: res.authResponse.accessToken
                }).then(
                    function(res) {
                    $log.debug("INTRO: User will be redirect to state requested");

                    // User FB account exist and he's now authenticated into system
                    // Redirecting user to requested page
                    $state.go("home");
                    }, function(err) {
                    $log.debug("ERROR INTRO: FB user credentials appear to be not associate with any user in the system");

                    // System didn't recognize FB credentials inside system
                    // Try to ask to the user if has a valid app account
                    $state.go("check_user_account", {
                        accessToken: res.authResponse.accessToken
                    });
                    }
                );
                } else {
                $log.debug('INTRO: User cancelled login or did not fully authorize.');
                $$Loader.stop();
                }
            }, function() {
                $log.debug("INTRO: User refused to continue with login process");
                $$Loader.stop();
            });
            }, function(err) {
            $log.debug("ERROR INTRO: An error ocurred during FB initialization");
            $$Loader.stop();
            });
        } else {
            // If widget is not requested by an external platform treat case normally
            $$Loader.stop();
        }
        });
    }

功能由控制器绑定(下图)

 vm.fbLogin = fbLogin;

并在 HTML 中使用,例如 belo

<gbo-row gbo-if-widget
         gbo-if
         condition-value="true"
         condition-operator-value="'=='"
         condition-provider="TenantService"
         condition-provider-field="data.fbEnabled"
         condition-provider-async-function="isActive">
  <gbo-button gbo-effect
              gbo-effect-delay="500"
              on-click="vm.fbLogin()"
              label="fb_login_action"
              gbo-effect-name="fadeBottomTop"
              classes-inner-button="col s12 m12 l12 blue"
              classes="hidden white-text col s8 offset-s2 m4 offset-m4 l2 offset-l5">
  </gbo-button>
</gbo-row>

标签: facebookcordovaionic-frameworkpopupfbloginview

解决方案


推荐阅读