我想在使用 Javascript 登录后获取用户的 FID、电子邮件和姓名,所以我进行了 Ajax 调用并将它们保存到数据库中。
这是当前登录用户的代码:
if (response.status === 'connected') { // the user is logged in and connected to your application
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
// Alert with fid, email and name
} else { //the user isn't logged in to Facebook or isn't connected to the application
FB.login(function(response) {
if (response.authResponse) {
accessToken = response.authResponse.accessToken;
// Alert with fid, email and name
}
}, {scope: 'email'});
}
我该怎么做?