用$ cordovaOauth登录问题

时间:2015-07-30 20:02:47

标签: javascript angularjs cordova ngcordova

function facebookLogin() {
            $cordovaOauth.facebook("948645908488914", ["email"]).then(function (result) {
            displayData($http, result.access_token);
        }, function (error) {
            alert("Error: " + error);
        });
    }

我不确定电子邮件的价值应该是多少。如果是用户的电子邮件地址,则应该从中获取令牌?

我收到以下错误:

TypeError: Cannot read property 'hasOwnProperty' of undefined
    at Object.facebook (local://simulator/js/ng-cordova.min.js:24:6458)
    at facebookLogin (local://simulator/js/app/controllers/ng-controllers-all.js:47:23)
    at m.$scope.login (local://simulator/js/app/controllers/ng-controllers-all.js:43:9)
    at fn (eval at <anonymous> (local://simulator/js/angular.min.js:210:400), <anonymous>:2:206)
    at local://simulator/js/ionic-angular.min.js:20:5713
    at m.$eval (local://simulator/js/angular.min.js:134:83)
    at m.$apply (local://simulator/js/angular.min.js:134:309)
    at HTMLButtonElement.<anonymous> (local://simulator/js/ionic-angular.min.js:20:5695)
    at HTMLButtonElement.n.event.dispatch (local://simulator/js/jquery-2.1.4.min.js:3:6466)
    at HTMLButtonElement.r.handle (local://simulator/js/jquery-2.1.4.min.js:3:3241)(anonymous function) @ angular.min.js:107

1 个答案:

答案 0 :(得分:1)

email是您要求的权限,您传递的权限如下:

$cordovaOauth.facebook("APP_ID", ['public_profile','user_friends','email','user_groups','user_likes']).then(function(result) {
// Code

问题我猜是你没有在设备上进行测试。