我需要知道这是否可行,理想情况下是教程/代码等的一些链接。这将是理想的!
所以我会有一个名为" detect.php"的页面。用户访问此页面,如果他们登录到Facebook,他们将被带到一个URL,如果他们没有去另一个
所以即使他们目前没有在同一个浏览器中打开Facebook,这也需要工作,所以我猜这与Cookie有关吗?
我已经和程序员讨论了这个问题,他们说这是不可能的,除非你首先创建一个应用程序并允许该用户拥有Facebook权限。对我来说没有意义
如果没有正式的Facebook方式,可能是解决方法或其他想法?
非常感谢
答案 0 :(得分:1)
程序员是对的,你需要创建一个Facebook应用程序,以检测用户是否登录Facebook,但创建一个Facebook应用程序相当容易,用户状态的代码应如下所示:FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// 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
//redirect here
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
} else if (response.status === 'not_authorized') {
// the user is logged in to Facebook,
// but has not authenticated your app
//redirect here
} else {
// the user isn't logged in to Facebook.
}
});
{ {3}}