GAE 和 Facebook Connect:如何获取用户的年龄和性别?
我正在使用 Google App Engine 和 Facebook Connect。
我在 https://github.com/facebook/ 找到了 Facebook Python SDK python-sdk/tree/master/examples/appengine 它有一些基本用户登录和获取他们的名字和朋友的示例。
如何获取用户的其他信息?我希望了解他们的年龄和性别,以便我的应用程序正常运行。我知道它需要额外的权限才能获取该信息,但我该怎么做?
I'm working with Google App Engine and Facebook Connect.
I have found Facebook Python SDK at https://github.com/facebook/python-sdk/tree/master/examples/appengine and it has some examples for basic user login and getting their names and friends.
How can I get the user's other information? I would like to have their age and gender for my app to work properly. I know it requires additional permissions to get that information but how do I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要对用户的性别属性进行任何许可,并且可以通过当前日期减去用户的出生日期来计算年龄。
对于出生日期,您需要
user_birthday
扩展权限如果您愿意要了解如何请求权限,请在
scope
查询参数中指定它们,如下所示查看 github 上的示例 https://github.com/facebook/python-sdk/blob/master/examples/appengine/example.py
我自己并不了解 python,但是,如果您使用的是 python sdk,那么您可以像这样请求用户信息(从上面的示例推断),
现在您可以通过从当前日期减去用户日期来获取年龄。
You dont need any permission for Gender property of the user and for the Age you can calculate by Subtracting the User's Date of birth by current Date.
For Date of Birth you need
user_birthday
Extended PermissionIf you want to know how to request permissions specify them in
scope
query parameter like thisCheck out the example here on github https://github.com/facebook/python-sdk/blob/master/examples/appengine/example.py
I dont know python myself but, If you are using the python sdk then you can request user information like this (inferred from the example above)
now you can get age by subtracting user date from current date.