Facebook JS API不返回电子邮件 [英] Facebook JS API not returning email

查看:90
本文介绍了Facebook JS API不返回电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置一个新的应用程序,与我设置的另一个应用程序相同。客户端代码(php& js)除了不同的应用程序ID之外是100%完全相同的,原始应用程序每次都可以完美地运行。权限是默认值。该应用设置为活动。我的开发网站的域名被添加到应用程序。它实际上返回的用户对象罚款,id / name,但没有电子邮件。我查看了我正在登录的帐户,我的原始应用程序和这个应用程序都是一样的。

I'm trying to setup a new app, identical to another app I setup. The client side code (php & js) is 100% identical except for a different app ID, and the original app works perfectly every time. The permissions are default. The app is set to active. My dev site's domain is added to the app. It actually returns the user object fine, with id/name, but no email. I checked my account I'm logging in with, and both my original app and this one are identical.

我的集成是轻微定制的,所以我将实际的例子从Facebook的开发快速入门指南,同样精确的事情,没有电子邮件。我试过不同的api版本,没有骰子。

My integration is slightly customized, so I copied the actual example from Facebook's dev quick start guide, and same exact thing, no email. I tried different api versions, no dice.

这是Facebook中的错误?为什么一个应用程序可以工作,另一个应用程序的配置不一样?我通过屏幕进入屏幕,除了域名和应用程序名称之外,没有一个区别。

Is this a bug in facebook? Why does one app work, and another with the same exact configuration not? I went screen by screen and there isn't a single difference except domains and app name.

更新

问题是因为旧版应用是在1年前创建的,API版本为2.1。图表拉请求在2.1中默认退回电子邮件,2.4中您必须指定要使用/ me请求的字段。

Problem is because the old app was created 1 year ago, with API version 2.1. Graph pull request returned email by default in 2.1, and in 2.4 you must specify which fields to pull with the "/me" request.

推荐答案

自Graph API v2.4以来,您需要指定API调用中的字段:

Since v2.4 of the Graph API, you need to specify the fields in the API call:

/me?fields=name,email

在更改日志中搜索声明字段: https://developers.facebook.com/docs/apps/changelog#v2_4

Search for "Declarative Fields" in the changelog: https://developers.facebook.com/docs/apps/changelog#v2_4

这篇关于Facebook JS API不返回电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆