私はウェブサイトを持っていて、Facebookを使用してログインを使用しています。私は次のことをしたい:
ユーザーが私のWebサイトにアクセスします-Facebookでログインします-私は彼のFacebookデータと写真撮影許可証を読みます
例えば:
{
"id": "1"
"name": "John English"
"first_name": "John",
"last_name": "English"
"link": "https://www.facebook.com/johnenglish"
"username": "johnenglish"
"gender": "male"
"locale": "en_US"
....
}
と
{
"id": "2"
"name": "John English2"
"first_name": "John",
"last_name": "English2"
"link": "https://www.facebook.com/johnenglish2"
"username": "johnenglish2"
"gender": "male"
"locale": "en_US"
....
}
両方のユーザーがプライベート写真を持っています。javascriptを使用してWebアプリケーションでユーザー(id:2)からプライベート写真をロードできますか?例を教えていただけますか?
私はこれを試しました:
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
FB.api('/USER-ID(USER ID 2)/photos?access_token=' + accessToken, function(response) {
//A user access token is required to request this resource.
});
} else if (response.status === 'not_authorized') {
} else {
}
});
エラー:このリソースをリクエストするには、ユーザーアクセストークンが必要です。