안녕하세요 저는 facebook APP에 처음입니다. Facebook C# SDK 및 Javascript SDK에서 작업하고 있습니다. 하지만 문제는 AccessToken을 얻을 수없고 코드를 디버깅 할 수 없다는 것입니다. 아래 코드를 찾으십시오.accessToken을 수신 할 수없고 심지어 getLoginStatus 이벤트를 시작할 수 없습니까?
<div id="fb-root"></div> <!-- This initializes the FB controls-->
<script>
window.fbAsyncInit = function() {
FB.init({
appId: 'XXXXXXXXXXXXXXX', // App ID
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true // parse XFBML
});
// Additional initialization code here
alert("Additional initialization code here");
FB.Event.subscribe('auth.login', function (response)
{
debugger; ****//Debugger is not Raising****
if (response.status === 'connected') {
// connected
alert("Connected");
} else if (response.status === 'not_authorized') {
// not_authorized
} else {
// not_logged_in
}
});
FB.getLoginStatus(function (response) {
if (response.session) {
// logged in and connected user, someone you know
alert("Connected");
} else {
// no user session available, someone you dont know
}
});
FB.Event.subscribe('auth.authResponseChange', function (response) {
alert("Additional initialization code here");
if (response.status === 'connected') {
alert("Bhuvan"); `// Event Not Raising`
// the user is logged in and has authenticated your
// app, and response.authResponse supplies
// the user's ID, a valid access token, a signed
// request, and the time the access token
// and signed request each expire
debugger;
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
// TODO: Handle the access token
// Do a post to the server to finish the logon
// This is a form post since we don't want to use AJAX
var form = document.createElement("form");
form.setAttribute("method", 'post');
form.setAttribute("action", 'FacebookLogin.aspx');
var field = document.createElement("input");
field.setAttribute("type", "hidden");
field.setAttribute("name", 'accessToken');
field.setAttribute("value", accessToken);
form.appendChild(field);
document.body.appendChild(form);
form.submit();
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
// but has not authenticated your app
} else {
// the user isn't logged in to Facebook.
}
});
};
// 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>
<div class="fb-login-button" data-show-faces="true" data-width="400" data-max-rows="1"></div>
로그인 할 수 있지만 이벤트를 처리 할 수 없습니다. 왜 내가 이벤트를 일으킬 수 없는지 그리고 왜 내가 엑세스 코드를 찾을 수 없는지 알 수 있습니까?
PLS는에서 볼 불을 지르고 또는 Crome 스 콘솔 어떤 JS 오류가이 경우 여기를 붙여 넣기를 channel.html라는 HTML 파일을 만듭니다. – sajanyamaha