4

I'm making a Facebook page app, and I need to get some extra permissions from my users, this prompts a pop up window which a lot of people have blocked, I remember seeing a lot of apps directing to a grant permission page with a callback url to handle this.

Is this depricted ? If not how can I use the embedded page rather the a pop up?

I'm sorry if this sounds like a lazy question, but it's been so long since I've been involved with Facebook and their API seems like a massive moving target, any tips would be greatly appreciated.

Thank you.

Daniel
  • 23,129
  • 12
  • 109
  • 154
  • This is a working solution, I think it helps for you too: http://facebook.stackoverflow.com/questions/6817641/facebook-authentication-implementation/7183892#7183892 – Sándor Tóth Aug 25 '11 at 10:42

3 Answers3

7

Try this little function in straight Javascript.

<script>
    function addPermissions(permissions){
        FB.login(function(response) {
            if (response.session) {
                if (response.perms) {
                    // user is logged in and granted some permissions.

                } else {
                    // user is logged in, but did not grant any permissions

                }
            } else {
                // user is not logged in
            }
        }, {perms:permissions});
    }
</script>
<a onclick="addPermissions("email, publish_stream,...");">Click me</a>
Francis Pelland
  • 784
  • 4
  • 11
0

If you don't pop the window at page load and do it in response to a link/button click the popup blocker shouldn't block it, aka the User actually requested the Pop to work. (I've had it working this way)

You can alternatively create the relevant authorisation URL and just send the user there.

Initially you send them there via dialog or redirect. You can just send them there again requesting the additional permissions aka Scope.

Details:

https://developers.facebook.com/docs/authentication/

The URL for the dialog can either pop into a new window or redirect to it. A new window normally pops from using the Javascript API.

Barry Carlyon
  • 1,039
  • 9
  • 13
0

I believe the popup method is deprecated. The standard method is to redirect to the facebook oauth dialog with a callback. There is an alternative popup method for iframe apps that isn't really a popup that would be blocked, it's more of an ajax popup.

The information you need as far as usage of the dialog I had mentioned is located at http://developers.facebook.com/docs/reference/dialogs/oauth/

Steve Buzonas
  • 5,300
  • 1
  • 33
  • 55