access redirect to login and redirect again

Hi all.

I have a post controller with an action actionTest, which only allow authenticated user to access.

Therefore, guest user will be redirected to site/login automatically if he tried to access post/test.

(Am I right so far?)

My problem is that I’d like to redirect the user to fb login page, so my code in SiteController is:

	public function actionLogin() {

		if($this->_identity === null) {

			$this->_identity = new UserIdentity($this->_facebook);




		if($this->_identity->errorCode === UserIdentity::ERROR_NONE) {

			Yii::app()->user->login($this->_identity, 0);


		} else {



However I can’t redirect it. I tried to modify it to be $this->redirect(“”) and the result is the same.

The chrome error message show that "GET undefine(undefined)"

How could I debug this? Please help, thanks!

Are you sure the code reaches the redirect to facebook line? try var_dumping that line and see if it prints, I just checked and :


works fine for me

$facebook is ofcourse the full http path to facebook, Yii won’t let me post links as this is my first post :D

So sorry that I found a stupid error in my code.

It works now. Thanks for reply.