如何在js中使用facebook api请求用户权限? [英] how to request user permissions using facebook api in js?

查看:116
本文介绍了如何在js中使用facebook api请求用户权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在js中使用facebook api请求用户权限?
我想让人们使用Facebook登录登录我的网站。那么我想从访问者请求facebook数据。现在我可以使用js获取这样的数据。

  FB.api('/ 100005658545226?fields = id,name,email') => 

{
id:100005658545226,
name:Mingfish Lin
}
/ pre>

但是在回复json中没有电子邮件信息,所以我想发送一个请求,要求用户授权此电子邮件权限。如何在js中做这个工作?例如什么是波纹管。

解决方案

具有回调的login方法和具有数组作为scope属性的options对象,例如:

  FB.login(callback ,{scope:['email']}); 

Facebook权限


how to request user permissions using facebook api in js? I want to let people login my site using facebook login. then I want to request facebook datas from the visitor. now I can get datas like this using js

FB.api('/100005658545226?fields=id,name,email') =>

{
    "id": "100005658545226",
    "name": "Mingfish Lin"
}

but there is no email info in the response json, so I want to send a request to ask user to authorize this email permission . how can I do this job in js? such as what does bellow.

解决方案

Call the login method with a callback and an options object with an array as the scope property, such as:

FB.login(callback, {scope: ['email']});

More info at Facebook Permissions

这篇关于如何在js中使用facebook api请求用户权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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