简体   繁体   中英

Ionic + Facebook Login with openfb.js

I used this tutorial for the Facebook integration in my app:

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.

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

.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.'
               });
            }
        });
    };
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM