このチュートリアルを実行しようとしていますhttps://developers.facebook.com/docs/howtos/login/getting-started/
私はこのチュートリアルが提供するのに必要なすべてを実行しました(私は思います)。目標は、OAuthを使用してWebページでユーザーのFacebook情報を認証できるようにすることです。
私のHTMLのコードは次のとおりです...
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function main(){ // runs all the other methods when needed, and maintains the proper path from making the form to posting to Facebook
var imageURL = getImageURL();
$("img[src='" + imageURL + "']").after("</br><form><input type=\"checkbox\" name=\"geo\" value=\"geolocation\"><b>Use Geolocation?</b> </br> <b>Additional Information About the Image: </b> <input type=\"comment\" name=\"cmnt\"></form>");
alert("Form should have been placed.");
}
function getImageURL(){
var url = "http://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Solid_black.svg/200px-Solid_black.svg.png";
return url;
}
function login() {
FB.login(function(response) {
if (response.authResponse) {
// connected
testAPI();
} else {
// cancelled
}
});
}
function testAPI() {
alert('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
alert('Good to see you, ' + response.name + '.');
});
}
</script>
</head>
<body onload="main()">
<div id="fb-root"></div>
<script>
//-----------------------------
// This is an initilization script created by Facebook.
//-----------------------------
// Additional JS functions here
window.fbAsyncInit = function() {
FB.init({
appId : 'hiddenappid', // App ID
channelUrl : 'hiddenwebpage', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Additional init code here
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// connected
} else if (response.status === 'not_authorized') {
// not_authorized
login();
} else {
// not_logged_in
login();
}
});
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
</script>
<b> Page </b>
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Solid_black.svg/200px-Solid_black.svg.png">
</body>
</html>
少しコードですが、主にチュートリアルのすべてのコードです。基本的に残りは無視できます。
この認証スクリプトを実行するにはどうすればよいですか?ページを開始しても何も起こりません。
さらに、これを実際のWebページから実行しているのではなく、htmlファイルを実行しているだけです。それがそれに影響を与える可能性がある場合、私もプロキシの後ろにいます。前もって感謝します!