Last active
August 29, 2015 14:05
-
-
Save RadianSmile/a2488fe23ae0f0724a28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<script type="text/javascript"> | |
window.fbAsyncInit = function() { | |
Parse.initialize("xxx", "xxx"); | |
Parse.FacebookUtils.init({ | |
appId : 'xxx', | |
cookie : true, | |
xfbml : true, | |
version : 'v1.0' // !! I change this because some said to do this. I forget the reference | |
}); | |
}; | |
(function(d, s, id) { | |
var js, fjs = d.getElementsByTagName(s)[0]; | |
if (d.getElementById(id)) return; | |
js = d.createElement(s); js.id = id; | |
js.src = "//connect.facebook.net/zh_TW/all.js"; // !!here I change the sdk.js to all.js | |
// if not , there would warn that: Setting authResponse is not supported | |
fjs.parentNode.insertBefore(js, fjs); | |
}(document, 'script', 'facebook-jssdk')); | |
</script> | |
</head> | |
<body> | |
<div id="fb-root"></div> | |
<script type="text/javascript"> | |
function logout () { | |
FB.logout(function(response) { | |
console.log ("Logout"); | |
}); | |
} | |
function fb_login () { | |
Parse.FacebookUtils.logIn(null, { | |
success: function(user) { | |
if (!user.existed()) { | |
document.location="signup.html"; | |
} else { | |
document.location ="dashboard.html"; | |
} | |
}, | |
error: function(user, error) { | |
console.log (error.message); | |
alert("User cancelled the Facebook login or did not fully authorize."); | |
} | |
}); | |
} | |
fb_login () ; // !!The supplied Facebook session token is expired or invalid. | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment