2
我使用Facebook登录API登录到我的网站。如何使用Facebook登录API
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'My_app_id',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<div class="fb-login-button" data-scope="email,user_birthday">
Login with Facebook
</div>
我正在使用此代码从Facebook进行身份验证。但是,在用户允许如何从设置的cookie获取用户信息的权限之后,我应该如何知道用户允许或不允许这些权限。我的网站基于php。
我想要一种机制,在授予权限后知道用户是否已通过身份验证,然后访问其信息。
请仔细阅读[facebook认证指南](https://developers.facebook.com/docs/authentication/)它包含客户端和服务器端流程的示例(使用PHP)。您可以使用[JS](https://developers.facebook.com/docs/reference/javascript/)或[PHP SDK](https://developers.facebook.com/docs/reference/php/)访问图形API。 。 – 2011-12-29 17:15:24