**我的问题是我可以使用 facebook 登录什么无法获取用户详细信息我的代码在下面。我在 site_url(facebook 应用程序)中还有一个问题,url 应该是重定向 uri?**
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '*******', status: true, cookie: true,
xfbml: true});
FB.Canvas.setAutoResize();
FB.getLoginStatus(function(response) {
if (response.session) {
FB.api('/me', function(response) {
$('#name').val(response.first_name);
});
} else {
// no user session available, someone you dont know
}
});
};
(function() enter code here{
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
function fblogin() {
FB.login(function(response) {
if (response.session) {
if (response.perms) {
// user is logged in and granted some permissions.
// perms is a comma separated list of granted permissions
} else {
// user is logged in, but did not grant any permissions
}
} else {
// user is not logged in
}
}, {perms:'read_stream,publish_stream,offline_access'});
};