开发者

Facebook JS SDK FB.Login() how do I get extended permissions?

I am trying to get extended permissions with my FB Connect 开发者_如何学GoApplication.

I was wondering how one does this with FB.Login() as I am not very knowledgable in JS.

Thanks


FB.Login() docs have an example:

<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'});
}


Please note that "perms" should be updated to "scope" otherwise will not work with the OAuth api

 FB.login(function(response) {
   // handle the response
 }, {scope: 'email,user_likes'});

See facebook docs


What I did, using the code from the Developer site, instead of using the "<fb:login-button>", I used this:

<a href="#" onclick="FB.login(function(response){},{perms:'email,publish_stream'});">

And it works great.


if you are using C# code then you can use this:

protected void Login(object sender, EventArgs e)
{
    FaceBookConnect.Authorize("user_photos,publish_stream", Request.Url.AbsoluteUri.Split('?'[0]);          
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜