Facebook API注册用户 - 错误100:无效的电子邮件散列 [英] Facebook API registerUsers - Error 100: Invalid email hash

查看:131
本文介绍了Facebook API注册用户 - 错误100:无效的电子邮件散列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PyFacebook我正在尝试通过我的Facebook应用程序注册我的网站的测试用户。我可以连接到API,并返回朋友列表等。但是,当尝试使用以下方式注册地址时:

Using PyFacebook I am trying to register a test user of my site with my facebook application. I can connect to the API fine and return a list of friends etc. However when trying to register an address using:

hashed_emails = facebook.hash_email('foo@bar.com')
accounts = [hashed_emails]
facebook.connect.registerUsers(accounts)

我得到:


FacebookError:错误100:无效
电子邮件哈希指定当尝试
使用connect.registerUsers(accounts)

FacebookError: Error 100: Invalid email hash specified when trying to use connect.registerUsers(accounts)

然而我知道散列是正确的,作为测试哈希文件返回相同的结果:

Yet I know the hash is correct as the test hash in the documentation returns the same result:

mary@example.com = 4228600737_c96da02bba97aedfd26136e980ae3761

我也知道使用的电子邮件地址绝对是Facebook用户。此外,connect.getUnconnectedFriendsCount()可以正常运行并返回预期的结果(0!) - 建议指向应用程序的链接可以。

I also know the email address used is definitely a Facebook user. Moreover connect.getUnconnectedFriendsCount() works fine and returns the expected result (0!) - suggesting the link to the App is OK.

发生了什么? connect.registerUsers()只有在被授予权限才能使用Friend Linking的情况下才会有效?或者是错误信息我正在收到一些不同的结果捕获全部?或者我只是误解了使用connect.registerUsers()?

What's going on? Is connect.registerUsers() something that would only work once I've been given 'permission' to use Friend Linking? Or is the error message I'm receiving a catch all for a number of different results? Or have I just misunderstood the use of connect.registerUsers()?

推荐答案

我对API的请求数组格式不正确。应该是:

My request array to the API was incorrectly formatted. It should have been:

hashed_emails = facebook.hash_email('foo@bar.com')

# Wrong: accounts = [hashed_emails]
accounts = [{"email_hash": hashed_emails}] 

facebook.connect.registerUsers(accounts)

哪个返回了预期的响应(已注册的哈希表),并被connect.getUnconnectedFriendsCount()进一步验证,现在返回1.

Which returned the expected response (list of registered hashes) and was further proven by connect.getUnconnectedFriendsCount() which now returns 1.

这篇关于Facebook API注册用户 - 错误100:无效的电子邮件散列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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