Facebook connect“发生错误.请稍后再试." [英] Facebook connect "An error occurred. Please try again later."
问题描述
我的页面上有一个链接,并且当我单击链接并转到Facebook时,链接具有由该$facebook->getLoginUrl();
设置的href,我收到此错误:An error occurred. Please try again later.
:| ?有什么帮助吗?谢谢!
I have a link on my page and the links has the href set by this $facebook->getLoginUrl();
when I click on the link and go to facebook I get this error: An error occurred. Please try again later.
:| ? Any help? Thanks!
<?php
class iM_Action_Helper_FbData extends Zend_Controller_Action_Helper_Abstract
{
public function direct(array $params = array())
{
return true;
}
/*
* Connecting to facebook
* It connects to facebook, this is used when you need to log a user out,
* or if you want to get some data about a user which uses facebook
* @return OBJ
*/
public function fbConnect()
{
$getFB = Zend_Registry::get('FB');
$facebook = new Facebook(array(
'appId' => $getFB->FB->APPID,
'secret' => $getFB->FB->SECRET,
'cookie' => true
));
return $facebook;
}
/*
* Checks to see if a user is loggedin
* @param string $redirect
*/
public function checkIfLogged($redirect = "/")
{
$fbLogin = new Zend_Session_Namespace('fbLogin'); #Get Facebook Session
if(!$fbLogin->user) $this->getActionController()->getHelper('redirector')->gotoUrl($redirect); #Logout the user
}
public function fbLoginUrl()
{
$facebook = $this->fbConnect();
return $facebook->getLoginUrl();
}
}
我在动作控制器中执行的操作,将这个$this->getHelper('FbData')->fbLoginUrl();
传递给视图,它返回Facebook登录URL,因此,当用户单击链接时,它将其重定向到Facebook,然后我想要重定向回我的页面以便我可以登录用户,我的整个概念是否错误?
What I do in my action controller, I pass this $this->getHelper('FbData')->fbLoginUrl();
to the view, what this does it return the facebook login url, so when the user clicks on the link, it redirect's it to facebook, and after that I want to be redirected back to my page so I can log the user in, is my whole concept wrong?
推荐答案
引起此问题的原因是,我在Facebook上为要尝试登录的网站设置了其他URL.
The problem was caused because I had other url set on facebook for the site that the one that I was trying to login.
这篇关于Facebook connect“发生错误.请稍后再试."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!