Facebook Developer: Permission optional

Facebook asked me to redesign my app because some features are becoming obsolete.

Now I have to ask the user to allow "publish_stream" when logging in.

When the user permits permission, he is redirected to the site, and everyone is happy. When it does not allow → it is requested again and again to infinity.

I want this permission to be optional. He will be able to use the application with or without permission, and the application will act accordingly (publish or not 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 permission optional?

+3
source share
1 answer

Use the "onlogin" property on the Facebook login page to connect the handler after logging in; you will call the following code:

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

showPermissionDialog will not display a dialog if they already have the requested permission; if you want to not be asked every time (if they deny), you need to save / remember that they did not give permission in your database or something else, and do not request permission at the next login.

Check out the FB documentation .

+3
source

Source: https://habr.com/ru/post/1726065/


All Articles