0
古いスクリプトをデバッグしていたところで、Facebookユーザーの一部のデータをクエリしてデータベースに格納する必要がありました。Facebook Graph APIの名前は空のままです
publish_streamのようなスコープの一部は非推奨になっているため、「publish_actions」に置き換えています。少なくとも私が理解できなかった何かがある。私はユーザーの姓と名を照会したいが、この返信は空のままで、サムネイルとユーザーIDだけが機能する。
ここにスコープがあります(私はpublic_profileは必要ではありませんが、Facebookは推奨しています)。
//function handleFacebookAuth(callback) {
function handleFacebookAuth(callback) {
var permissions = '';
//noinspection JSUnresolvedVariable
if (window.extendedPerms) {
permissions = 'public_profile,email,publish_actions,user_likes,' + window.extendedPerms;
} else {
permissions = 'public_profile,email,publish_actions';
}
if (accessToken != null && userId != null) {
callback(accessToken, userId);
} else {
FB.login(function (response) {
if (response.authResponse) {
userId = response.authResponse.userID;
accessToken = response.authResponse.accessToken;
callback(accessToken, userId);
} else {
$("#white-wall").hide();
}
}, {scope: permissions});
}
return false;
}
そして、ここで私は多分誰かがそれで間違いを見ることを願っていたデータ
function sendData(moves, seconds) {
FB.api('/me', function (response) {
var data = {
access_token: accessToken,
flag: 'data',
fbuid: response.id,
moves: moves,
seconds: seconds,
fname: response.first_name,
lname: response.last_name,
email: response.email,
gender: response.gender
};
userId = response.id;
$.ajax({
url: "ajax.php",
data: data, dataType: 'html', method: "post",
error: function (data) {
alert(data.responseText);
},
success: function (data) {
console.log(data);
//$("#gameresults").html(data);
$('#gameresults').html(data);
$("#triggerbtn").fancybox({
'width': 480,
'height': 550,
'autoSize': false,
'overlayShow': false,
'scrolling': 'no'
});
$("#triggerbtn").trigger('click');
//window.top.location.href = data;
}
});
});
}
への照会、私は本当に多分問題があるかもしれない、それと間違っているかを把握することはできません上記の私のコードが大丈夫であることを聞いて嬉しいです。
だった私/
に追加 かなり簡単でした。ちょうどStackOverflowを検索するこの質問は毎日来る – WizKid
オハイオ州彼らはmore.From私は正確にAPI 2.4からのフィールドを照会することです理解して何よりも変わったようだ。ありがとうございました – Deex