AWS 람다를 사용하여 현재 사용자와 다른 사용자 간의 모든 친구를 물어 봅니다 : https://developers.facebook.com/docs/graph-api/reference/user-context/all_mutual_friends/FB 그래프 API : 모든 상호 친구 잡기 - (# 200)이 작업을 수행 할 수있는 충분한 권한이 없습니다.
나는 다른 모든 유래 답변을 통해 보았다 정말 충분히 가까이를 찾을 수 없습니다 여전히 이와 같은 오류를 얻을 답의 각을 따랐다 : Facebook Graph All Mutual Friends 및 "Requires a valid user is specified ..." error when using getCount
내 코드는 같다 아래 AWS에서이 node.js 타사 sdk (,548,751,) :
// Imports third-party fb graph api node.js sdk: https://github.com/node-facebook/facebook-node-sdk
const fbGraph = require('fb');
// Grabs app secret and app ID
const appSecret = process.env.APP_SECRET;
const appID = process.env.APP_ID;
// Uses user access token and grabs total count of all relevant mutual friends
exports.handler = (event, context, callback) => {
// Grabs relevant details from request
// const accessToken = event.accessToken;
const friendUserID = event.friendUserID;
fbGraph.api('oauth/access_token', {
client_id: appID,
client_secret: appSecret,
grant_type: 'client_credentials'
}, function (res) {
if(!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
let access_token = res.access_token;
// Sets options for fb graph api to work
fbGraph.options({accessToken: access_token, appId: appID, appSecret: appSecret, timeout: 12000});
// Sets up fields and query string for request
const friendUserIDQueryString = '/' + friendUserID;
const fields = {
fields: 'context.fields(all_mutual_friends.limit(10))'
};
// Sends api request to get all mutual friends
fbGraph.api(friendUserIDQueryString, 'post', fields, function(response) {
console.log(response);
// Error handling
if (response.error) {
// Logs error
context.done(null, { MutualFriendsTotalCountError: 'Error: not able to receive response' });
// Returns error message
return callback(new Error(`Mutual friends total count error: ${response.error}`));
}
// Logs successful operation
context.done(null, { MutualFriendsTotalCountSuccess: `Success: grabbed total mutual friend count for ${friendUserID}`});
// Returns total count of mutual friends between current and other user as integer
return callback(null, { total_count: response.context.all_mutual_friends.summary.total_count });
});
});
}
하지만 내 대답은 지금은 이것이다 : 나는이 사용하고
내가 정말 이해가 안{ error:
{ message: '(#200) You do not have sufficient permissions to perform this action',
type: 'OAuthException',
code: 200,
...
}
, 내 iOS 앱에 내 자신의 액세스 토큰을 사용했습니다 , OAuth를 통한 애플리케이션 앱 토큰 및 내 앱에 존재하는 다른 사용자 ID이며 내 앱 및 기타 권장 솔루션을위한 것이 아닙니다.