I am using the Javascript SDK to post score to FB but it is giving me error ({error:{message:”(#15) This method must be called with an app access_token.”, type:”OAuthException”, code:15}}) :
I am using accessToken coming from following:
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// the user is logged in and has authenticated your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire
uid = response.authResponse.userID;
accessToken = response.authResponse.accessToken;
The function i am using to post score is following:
FB.api("uid/scores", 'post', {score: scoredata, access_token: accessToken },
function(response)
{
if (!response || response.error) {
console.error(response);
} else {
console.log(response);
}
});
Can anyone please give idea since fb is missing docs for JAvascript specially.
Jacob
It’s because of fact that scores should be posted as application not as users.
What you trying to do should be done using Application
access_tokenand from server-side (not JavaScript in browser) so your application secret will not be revealed.