域名更改后的Facebook身份验证问题

时间:2012-10-22 13:10:26

标签: facebook authentication cookies

我有一个facebook身份验证:

  

$ facebook = new Facebook(array('appId'=> FACEBOOK_APP_ID,'secret'=> FACEBOOK_APP_SECRET));

    // get the facebook user id
    $userId = $facebook->getUser();
    // if there isn't one that means that the user needs either to login in to facebook
    // or that the user needs to accept the application
    if (!$userId) {
        // set the permissions, in this case only the email
        $login_url = $facebook->getLoginUrl(array(
            'scope' => 'email'
        ));

        // got to the facebook login url
        $this->_redirect($login_url);
    }
    // get the user profile
    $userProfile = $facebook->api('/me', 'GET');
    // create a user

在我的本地它工作正常,但在服务器上getUser()不返回有效的用户ID。所以它进入一个重定向循环,你可以弄清楚。它工作了一段时间,但今天在服务器上更改了域名,它停止工作。我已经在facebook上对应用程序进行了所有更改(设置了正确的域名),但它仍然没有返回正常。 Facebook是否尝试在服务器上设置cookie,但是失败并且仅在我在本地计算机上执行时才成功?或者这可能是什么原因?仅供参考我也有推特认证,它今天也停止了工作。可能是同一个问题

0 个答案:

没有答案