
facebook APIを使う機会が出来たので情報まとめ
認証が必要なAPIをたたくとき
var appId = "appIDを入れる";
if(window.location.hash.length == 0){
url = "https://www.facebook.com/dialog/oauth?client_id=" +
appId + "&redirect_uri=" + window.location + "&response_type=token";
window.location.href = url;
} else {
accessToken = window.location.hash.substring(1);
//Friendsを取得
graphUrl = "https://graph.facebook.com/me/friends?" + accessToken + "&callback=コールバック名"
//use JSON-P to call the graph
var script = document.createElement("script");
script.src = graphUrl;
document.body.appendChild(script);
}
※ connectionについて調べる
