Facebook Extended Resolution Required: publish_actions

I am developing a Facebook application to participate in the competition and promotion, and I intend to create a tab on my company page that will give you access to the application.

As soon as their users can appoint local companies to receive rewards. Later; after the nominations will be, users can vote for the winner.

I have included Open Graph in my application to use Object Types ( Organization ), Action Types ( Nominate , Vote For ), and Aggregations ( Nominations ). My main task is to transfer these actions to the user's timeline.

I used an example recipe as a base. I provided my code to demonstrate authentication, and the post action needed to send a combination of action types / object types.

 <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <head prefix="og: http://ogp.me/ns# og_<<app namespace>>: http://ogp.me/ns/apps/<<app namespace>>#"> <meta property="fb:app_id" content="<<app id>>" /> <meta property="og:type" content="<<app namespace>>:organization" /> <meta property="og:title" content="Client 1" /> <meta property="og:image" content="<<client image path>>" /> <meta property="og:description" content="Client 1 description here ... " /> <meta property="og:url" content="<<custom client URL>>"> <script src="http://connect.facebook.net/en_US/all.js"></script> <script type="text/javascript"> // Load the SDK Asynchronously (function(d){ var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) {return;} js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); }(document)); // Init the SDK upon load window.fbAsyncInit = function() { FB.init({ appId : '<<app id>>', // App ID status : true, // check login status cookie : true, // enable cookies to allow the server to access the session xfbml : true // parse XFBML }); // listen for and handle auth.statusChange events FB.Event.subscribe('auth.statusChange', function(response) { if (response.authResponse) { // user has auth'd your app and is logged into Facebook FB.api('/me', function(me){ if (me.name) { document.getElementById('auth-displayname').innerHTML = me.name; } }) document.getElementById('auth-loggedout').style.display = 'none'; document.getElementById('auth-loggedin').style.display = 'block'; } else { // user has not auth'd your app, or is not logged into Facebook document.getElementById('auth-loggedout').style.display = 'block'; document.getElementById('auth-loggedin').style.display = 'none'; } }); // respond to clicks on the login and logout links document.getElementById('auth-loginlink').addEventListener('click', function(){ FB.login(); }); document.getElementById('auth-logoutlink').addEventListener('click', function(){ FB.logout(); }); } function nominate () { FB.api('/me/<<app namespace>>:Nominate&organization=<<custom client URL>>', 'post', function(response) { if (! response || response.error) { alert('Error occured'); console.log(response); } else { alert('Post was successful! Action ID: ' + response.id); } }); } </script> </head> <body> <div id="fb-root"></div> <div id="auth-status"> <div id="auth-loggedout"> <a href="#" id="auth-loginlink">Login</a> </div> <div id="auth-loggedin" style="display:none"> Hi, <span id="auth-displayname"></span> (<a href="#" id="auth-logoutlink">logout</a>) </div> </div> <h2>Client 1</h2> <form> <input type="button" value="Nominate" onclick="nominate()" /> </form> <fb:activity actions="<<app namespace>>:nominate"></fb:activity> </body> </html> 

The user under test has the following error:

 Requires extended permission: publish_actions 

And I came across the following error (I am the administrator for this application):

 This method must be called with an app access_token 

The first mistake bothers me. I can not select publish_actions from Apps | <My App> | Permissions | Extended Permissions Apps | <My App> | Permissions | Extended Permissions Apps | <My App> | Permissions | Extended Permissions . In addition, the fixes that I discovered suggest me reclassify my application to Games (this does not work) and complete my aggregations (I still did not work).

  • How can I overcome this mistake?
  • What can I do to fix my error This method must be called with an app access_token ?

Thanks in advance,

Mike

EDIT

I believe that the access_token error that I encountered was related to the fact that I tested / interacted with the application directly on the page URL; not via Facebook.

I no longer get Requires extended permission: publish_actions error ; however, my testers and developers. I know that I am encountering this error because publish_actions permission is not requested at the login facebook.com login prompt.

If my developers / testers log out of Facebook, then go to my invitation:

 FB.login(function (response) { }, { scope:'publish_actions'}); 

This permission and application are then integrated into their Facebook session.

My last question is, is there defacto, the preferred method for requesting this permission without logging in to / from Facebook?

+4
source share
2 answers

I fixed both my mistakes. Thanks to those who provided me with feedback and put me on the right track.

These errors have been fixed:

 1. Requires extended permission: publish_actions 2. This method must be called with an app access_token 

For starters, CBroe is right. Since I need advanced permissions (publish_actions) , I need to indicate that this is my object of objects after the callback function in FB.login() as follows:

 FB.login(function (response) { if (response.authResponse) { // The user has authenticated authenticatedSoDoSomething(); } else { // The user has not authenticated notAuthenticatedSoDoSomethingElse(); } }, { scope:'publish_actions' }); 

Finally, I did not manage to use the JavaScript SDK to publish the action on the user's timeline via FB.api() . This is the code I was using:

 FB.api('/me/<<app namespace>>:<<my action>>&<<my object>>=<<a URL>>', 'post', function(response) { if (! response || response.error) { alert('Error occured'); } else { alert('Post was successful! Action ID: ' + response.id); } }) 

I forgot to enable the application access token. An application access token can be constructed by combining the application identifier, followed by the pipe, and then the application secret.

I used the PHP SDK to execute this request as I wanted to keep the api secret secret. Here is the [most] code that I used:

 require_once('facebook-php-sdk/src/facebook.php'); $facebook = new Facebook( array( 'appId' => '<<my app id>>', 'secret' => '<<my app secret>>')); $user = $facebook->getUser(); if ($user) { try { $user_profile = $facebook->api('/me'); } catch (FacebookApiException $e) { error_log($e); $user = null; echo json_encode(array('success' => false)); } } try { $facebook->api('/' . $user . '/<<app namespace>>:<<my action>>&<<my object>>=<<a URL>>', 'POST', array('access_token' => $facebook->getAppId() . '|' . $facebook->getApiSecret())); } catch (FacebookApiException $e) { echo var_dump($e->getResult()); } 

Hope this helps!

+2
source

For the second, make a call with the App App Token , as the error says; if you already do this and it fails, check that the application is not installed in the "Home / Desktop" mode in the application settings in the facebook App control panel. If so, the application access token is not trusted, and the API acts as if you did not provide it.

First, are you sure that users provide publish_actions permission for your application? Calling /me/permissions with a user access token will show you what permissions are granted. Please note that the authenticated referral / application entry stream is separate from your regular application stream for users who go there except through an authenticated referral or application center, so make sure you include publish_actions in scope in your call to the Oauth dialog.

0
source

All Articles