javascript Facebook JS SDK FB.Login() 如何获得扩展权限?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3604321/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Facebook JS SDK FB.Login() how do I get extended permissions?
提问by Thomas Clowes
I am trying to get extended permissions with my FB Connect Application.
我正在尝试使用我的 FB Connect 应用程序获得扩展权限。
I was wondering how one does this with FB.Login() as I am not very knowledgable in JS.
我想知道如何使用 FB.Login() 做到这一点,因为我对 JS 不是很了解。
Thanks
谢谢
回答by serg
FB.Login() docshave an example:
FB.Login() 文档有一个例子:
<INPUT TYPE="BUTTON" ONCLICK="fbLogin()" value="login">
function fbLogin() {
FB.login(function(response) {
if (response.session) {
//user is logged in, reload page
window.location.reload(true);
} else {
// user is not logged in
}
}, {perms:'read_stream,publish_stream,offline_access'});
}
回答by Future2020
Please note that "perms" should be updated to "scope" otherwise will not work with the OAuth api
请注意,“perms”应更新为“scope”,否则将无法与 OAuth api 一起使用
FB.login(function(response) {
// handle the response
}, {scope: 'email,user_likes'});
See facebook docs
回答by TerryMatula
What I did, using the code from the Developer site, instead of using the "<fb:login-button>", I used this:
我所做的,使用来自开发人员站点的代码,而不是使用“ <fb:login-button>”,我使用了这个:
<a href="#" onclick="FB.login(function(response){},{perms:'email,publish_stream'});">
And it works great.
而且效果很好。
回答by Dushyant
if you are using C# code then you can use this:
如果您使用的是 C# 代码,那么您可以使用以下代码:
protected void Login(object sender, EventArgs e)
{
FaceBookConnect.Authorize("user_photos,publish_stream", Request.Url.AbsoluteUri.Split('?'[0]);
}

