Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/464.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Firebase和AngularJS从Facebook检索公共配置文件_Javascript_Angularjs_Firebase_Firebase Authentication_Facebook Authentication - Fatal编程技术网

Javascript 使用Firebase和AngularJS从Facebook检索公共配置文件

Javascript 使用Firebase和AngularJS从Facebook检索公共配置文件,javascript,angularjs,firebase,firebase-authentication,facebook-authentication,Javascript,Angularjs,Firebase,Firebase Authentication,Facebook Authentication,所以,我一直在我的AngularJS/Ionic项目中使用Firebase,通过Facebook身份验证访问我的应用程序 认证进行得很顺利,它检索了一些数据(显示名称、电子邮件、urid、url照片等),但我需要更多 我需要知道我的项目的名字和姓氏,因为我需要使用它。当这个人接受分享信息时,它说她在分享她的公共档案,但所提供的数据没有Facebook文档所说的公共档案提供的信息 我使用Firebase文档对此进行编程。有一部分说使用addScope添加您想要的内容,默认情况下会询问公共配置文件

所以,我一直在我的AngularJS/Ionic项目中使用Firebase,通过Facebook身份验证访问我的应用程序

认证进行得很顺利,它检索了一些数据(显示名称、电子邮件、urid、url照片等),但我需要更多

我需要知道我的项目的名字和姓氏,因为我需要使用它。当这个人接受分享信息时,它说她在分享她的公共档案,但所提供的数据没有Facebook文档所说的公共档案提供的信息

我使用Firebase文档对此进行编程。有一部分说使用
addScope
添加您想要的内容,默认情况下会询问公共配置文件,但我还是添加了它。(我不能发布链接,StackOverflow说我的声誉太低)

在此处登录:

所以,因为我不想使用“显示名称”。因为那里的人有时不用真名


有人知道如何使用Firebase和AngularJS检索该信息吗?

目前Firebase不支持此功能。你必须对Facebook进行额外的api调用才能获得这些数据

result.credential.accessToken包含Facebook访问令牌。使用该访问令牌,您可以获取facebook个人资料数据。下面是一个如何使用facebook实现这一点的示例:


AJAX GET''+result.credential.accessToken

用于寻找如何使用AngularJS或如何筛选所需内容的人这是我如何使用bojeil提供的信息完成的!(再次感谢大家!)

非常感谢这就是我要找的。
$scope.FBLogin = function (){
firebase.auth().signInWithPopup(provider).then(function(result) {

  var token = result.credential.accessToken;
  var user = result.user;
  var profile = result.user.public_profile;
  console.log("success")
  console.log(result);
  console.log(user);


}).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // The email of the user's account used.
  var email = error.email;
  // The firebase.auth.AuthCredential type that was used.
  var credential = error.credential;
// ...
});
};
var token = result.credential.accessToken;
var user = result.user;

$http.get('https://graph.facebook.com/v2.5/me?  access_token='+token+'&fields=id,name,first_name,last_name,email')
  .success(function(jsonService){
     $scope.user.firstName= jsonService.first_name;
     $scope.user.lastName= jsonService.last_name
     $scope.user.email = jsonService.email;
  });