How to publish an invoice from the JavaScript JavaScript SDK

I want to send a rating from the JavaScript SDK. Here is my current attempt:

FB.api("/me/scores", 'post', {score: seconds, access_token: FB.getSession().access_token}, function(response){
       if (!response || response.error) {
          console.error(response);
       } else {
          console.log(response);
       }
});

I get an error message:

(#15) This method must be called with an app access_token.

Since I am passing an access token, why does this not work?

Thank.

+5
source share
2 answers

FB.getSession().access_tokenwill not return application access token. Application access tokens are intended for server-side use and are retrieved using the application and application identifier, as described here: https://developers.facebook.com/docs/authentication/#applogin .

NOTE. The secret of the application is similar to your password; it should never be sent to the client or embedded in client code.

+2

All Articles