{"action":"opened","issue":{"url":"https://api.github.com/repos/jeduan/cordova-plugin-facebook4/issues/57","labels_url":"https://api.github.com/repos/jeduan/cordova-plugin-facebook4/issues/57/labels{/name}","comments_url":"https://api.github.com/repos/jeduan/cordova-plugin-facebook4/issues/57/comments","events_url":"https://api.github.com/repos/jeduan/cordova-plugin-facebook4/issues/57/events","html_url":"https://github.com/jeduan/cordova-plugin-facebook4/issues/57","id":109314175,"number":57,"title":"facebookConnectPlugin always returns null","user":{"login":"bcbeatty","id":1178347,"avatar_url":"https://avatars.githubusercontent.com/u/1178347?v=3","gravatar_id":"","url":"https://api.github.com/users/bcbeatty","html_url":"https://github.com/bcbeatty","followers_url":"https://api.github.com/users/bcbeatty/followers","following_url":"https://api.github.com/users/bcbeatty/following{/other_user}","gists_url":"https://api.github.com/users/bcbeatty/gists{/gist_id}","starred_url":"https://api.github.com/users/bcbeatty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcbeatty/subscriptions","organizations_url":"https://api.github.com/users/bcbeatty/orgs","repos_url":"https://api.github.com/users/bcbeatty/repos","events_url":"https://api.github.com/users/bcbeatty/events{/privacy}","received_events_url":"https://api.github.com/users/bcbeatty/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-01T14:41:36Z","updated_at":"2015-10-01T14:41:36Z","closed_at":null,"body":"I have a simple app to login to Facebook. \r\nBut everytime I try to connect to facebook the plugin returns null.\r\n What am I missing?\r\nthanks\r\n\r\n\r\n```javascript\r\nangular.module('starter', ['ionic'])\r\n//... extra code removed\r\n\r\n.controller('loginCtrl', ['$scope', '$state', function($scope, $state) {\r\n  var fbLogged = new Parse.Promise();\r\n    \r\n  var fbLoginSuccess = function(response) {\r\n    if (!response.authResponse){\r\n      fbLoginError(\"Cannot find the authResponse\");\r\n      return;\r\n    }\r\n    var expDate = new Date(\r\n      new Date().getTime() + response.authResponse.expiresIn * 1000\r\n    ).toISOString();\r\n\r\n    var authData = {\r\n      id: String(response.authResponse.userID),\r\n      access_token: response.authResponse.accessToken,\r\n      expiration_date: expDate\r\n    }\r\n    fbLogged.resolve(authData);\r\n    console.log(response);\r\n  };\r\n\r\n  var fbLoginError = function(error){\r\n    fbLogged.reject(error);\r\n  };\r\n\r\n  $scope.login = function() {\r\n    console.log('Login');\r\n    if (!window.cordova) {\r\n        console.log('Login.cordova');\r\n      facebookConnectPlugin.browserInit('FACEBOOK_APP_ID');\r\n    }\r\n///facebookConnectPlugin is always null\r\n    facebookConnectPlugin.login(['email'], fbLoginSuccess, fbLoginError);\r\n  \r\n    fbLogged.then( function(authData) {\r\n      console.log('Promised');\r\n      return Parse.FacebookUtils.logIn(authData);\r\n    })\r\n    .then( function(userObject) {\r\n      facebookConnectPlugin.api('/me', null, \r\n        function(response) {\r\n          console.log(response);\r\n          userObject.set('name', response.name);\r\n          userObject.set('email', response.email);\r\n          userObject.save();\r\n        },\r\n        function(error) {\r\n          console.log(error);\r\n        }\r\n      );\r\n      $state.go('home');\r\n    }, function(error) {\r\n      console.log(error);\r\n    });\r\n  };\r\n}])\r\n```\r\nindex.html's body\r\n```html\r\n<head>\r\n  <script src=\"lib/ionic/js/ionic.bundle.js\"></script>\r\n <script src=\"js/app.js\"></script>\r\n  </head>\r\n <body ng-app=\"starter\">\r\n    <ion-pane>\r\n      <div ui-view></div>\r\n    </ion-pane>\r\n\r\n    <div id=\"fb-root\"></div>\r\n\r\n    <!-- Need to place at the end to prevent appendChild error -->\r\n    <script src=\"lib/facebookConnectPlugin.js\"></script>    \r\n  </body>\r\n```\r\nlogin.html\r\n```html\r\n<ion-content>\r\n  <div style=\"padding: 10px; height: 100%;\">\r\n    <button class=\"button button-block button-positive\" ng-click=\"login()\">\r\n      Log in with Facebook\r\n    </button>\r\n  </div>\r\n</ion-content>\r\n```\r\n"}}