Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook developer: making a permission optional

Facebook requested that I change my design of my application because certain functions become deprecated.

Now I have to ask the user for "publish_stream" permission when he logs in.

When the user allows the permission, he is redirected to the website and everyone's happy. When he doesn't allow -> he is being requested again and again until infinity.

What I want is that this permission will be optional. He will be able to use the application with or without the permission and the application will act accordingly (publish or don't publish the feed).

This is my code on the first page of my application.

<facebook:CanvasIFrameLoginControl runat="server" ID="login" 
RequireLogin="true" RequiredPermissions="publish_stream"/>

Help me continue from there... How do I make the permission optional?

like image 908
Faruz Avatar asked Mar 07 '26 23:03

Faruz


1 Answers

Use the "onlogin" property on the Facebook login button to hook up a handler for after they log in; you will then call the following code:

FB.Connect.showPermissionDialog("publish_stream", YOUR_RETURN_FUNC_HERE());

showPermissionDialog won't show the dialog if they already have the requsted permission; if you want them to not get asked every time (if they are denying), then you need to store/remember that they didn't give permission in your database or something, and don't request the permission next time they log in.

Check out FB's documentation.

like image 67
Nicholas Head Avatar answered Mar 10 '26 14:03

Nicholas Head