views:

43

answers:

2

Hello.

I am trying to get extended permissions with my FB Connect Application.

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

Thanks

+1  A: 

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'});
}
serg
Thankyou.I did see that, however I am not sure how to integrate it with my website.I want to have a custom login button of sorts, so I have a html button and an onclick call which calls FB.Login()<INPUT TYPE=BUTTON ONCLICK="FB_Login()"> in the basic idea.That works for basic permissions, but I also want to get the users email. The above code seems excessively complicated to get oe extra bit of info.Thanks
Thomas Clowes
@Thomas I updated the answer.
serg
Many Thanks ! Ill tick it shortly - perhaps you could clarify the workings such that I can develop my knowledge?I have little experience in JS - this was given to me as 'the best way of doing things with fb' so im trying to learn as i go.Can I assume to get the same fbml esque workings whereby on logging in my page is reloaded i can simply add something like document.reload()Thanks
Thomas Clowes
@Thomas Do you mean you want to reload a page once the user is logged in? You can use `window.location.reload(true)` for this (edited the answer).
serg
A: 

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.

TerryMatula