简体   繁体   English

Ionic +使用openfb.js登录Facebook

[英]Ionic + Facebook Login with openfb.js

I used this tutorial for the Facebook integration in my app: 我将本教程用于应用程序中的Facebook集成:

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

I have a problem after a successfully login. 成功登录后出现问题。 I can see a screen that show this: 我可以看到一个显示以下内容的屏幕:

SECURITY WARNING: Please treat the URL above as you would your password and do not share it with anyone. 安全警告:请像对待您的密码一样对待上面的URL,不要与任何人共享。

I can't get back to my app from it. 我无法从中回到我的应用程序。 Can anyone help me? 谁能帮我?

set facebook oath url to localhost:8100/outhcalback.html Add open.js and ngopen.js script into index.html Use below code 将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