在Cordova应用程序中使用FirebaseUI Facebook Auth时出错

时间:2016-06-07 16:50:10

标签: angularjs facebook cordova firebase angularfire

我正在尝试通过我的Cordova / PhoneGap应用中的FirebaseUI设置Facebook和Google身份验证,并且在点击“使用X登录”按钮时收到错误。该错误表明以下内容:

  

拒绝在>框架中显示'https://www.facebook.com/login.php?skip_api_login=1&api_key=643683385780436 ... _& display = page& locale = en_US& logger_id = 05e536a7-cf68-44a3-825b-63dd3edd5b0a',因为它设置'X-Frame-Options' '拒绝'。

经过一番研究后,我了解到X-Frame选项是由提供商设置的,我无法改变它。我已经查看了如何解决这个问题的线索,但答案要么不能解决问题,要么无法解决问题。任何解释都将非常感激。

我的代码如下:

登录控制器:

MyBaseClass

的login.html

app.controller("loginCtrl", function ($scope, $state, $rootScope, $firebaseAuth, $location) {

// Firebase config.
var config = {
    apiKey: "",
    authDomain: "",
};

// FirebaseUI config.
var uiConfig = {
    'queryParameterForWidgetMode': 'mode',
    'signInSuccessUrl': '/home',
    'signInOptions': [
        firebase.auth.FacebookAuthProvider.PROVIDER_ID,
        firebase.auth.GoogleAuthProvider.PROVIDER_ID
    ],
    // Terms of service url.
    //'tosUrl': '<your-tos-url>',
    'callbacks': {
        'signInSuccess': function (currentUser, credential, redirectUrl) {
            // Do something.
            // Return type determines whether we continue the redirect automatically
            // or whether we leave that to developer to handle.
            console.log('success');
            return true;
        }
    }
};

// Initialize the FirebaseUI Widget using Firebase.
var app = firebase.initializeApp(config);
var auth = app.auth();
var ui = new firebaseui.auth.AuthUI(auth);
// The start method will wait until the DOM is loaded.
ui.start('#firebaseui-auth-container', uiConfig);
});

相关index.html

<ion-view title="Sign In">
<ion-content>
    <div>

        <center>
            <br />
            <h1>Sign In</h1>
        </center>

        <div id="firebaseui-auth-container"></div>
    </div>
</ion-content>

谢谢!

萨姆

1 个答案:

答案 0 :(得分:0)

我也在尝试通过我的Cordova / PhoneGap应用中的FirebaseUI设置Facebook和Google身份验证。但是,在阅读FirebaseUI for Web — Auth文档时,我发现了以下内容:

  

FirebaseUI完全支持所有最近的浏览器。用。登录   联邦提供商(谷歌,Facebook,Twitter,Github)还没有   在非浏览器环境中受支持(Cordova,React Native,   Ionic ...)也不是Chrome扩展程序。

所以,遗憾的是,似乎还不支持将FirebaseUI与Cordova应用程序配合使用。