簡體   English   中英

Ionic +使用openfb.js登錄Facebook

[英]Ionic + Facebook Login with openfb.js

我將本教程用於應用程序中的Facebook集成:

https://ccoenraets.github.io/ionic-tutorial/ionic-facebook-integration.html

成功登錄后出現問題。 我可以看到一個顯示以下內容的屏幕:

安全警告:請像對待您的密碼一樣對待上面的URL,不要與任何人共享。

我無法從中回到我的應用程序。 誰能幫我?

將facebook宣誓URL設置為localhost:8100 / outhcalback.html將open.js和ngopen.js腳本添加到index.html中,使用以下代碼

.controller('DashCtrl', function($scope, $ionicModal, $timeout, ngFB, $rootScope, $state, $ionicPopup, $timeout, authenticationFactory, $location) {
    $scope.fbLogin = function () {
        ngFB.login({scope: 'email,user_friends,public_profile'}).then(function (response) {
            if (response.status === 'connected') {
                console.log('Facebook login succeeded');
                $rootScope.User = response;
                $rootScope.Auth =response.authResponse;
                $rootScope.accessToken = $rootScope.Auth.accessToken;
                authenticationFactory.setAuthentication($rootScope.accessToken);
                $state.go('tab.account');
            } else {
                $ionicPopup.alert({
                    title: 'Unauthorized!',
                    template: 'User cancelled login or did not fully authorize.'
               });
            }
        });
    };
})

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM