Yii Framework Forum: Login Fb Sdk - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Login Fb Sdk Login fb sdk Rate Topic: -----

#1 User is offline   rad11 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 17-May 14

Posted 11 June 2014 - 05:56 AM

Witam, mam problem gdyz fb login nie dziala poprawnie i nie wiem co robie zle:

moj kod wyglada tak
public function actionLoginFb() {
	
	Yii::import('ext.facebook', true);

	$facebook = new Facebook(array(
		    'appId' => 'xxxx',
		    'secret' => 'xxx',
		    'cookie' => true
		));

	$user_id = $facebook->getUser();
	var_dump($user_id);
	$me = null;

	if ($user_id) {
	    try {
		$me = $facebook->api('/me');
	    } catch (FacebookApiException $e) {
		print_r($e->getMessage());
	    }
	}
	if ($me) {
	    
	    
	    $log_out_url = $facebook->getLogoutUrl();
	    echo "<a href='$log_out_url'>Logout</a>";
	} else {
	    
	    $facebook->destroySession();
	    $log_in_url = $facebook->getLoginUrl(array(
				'redirect_uri' => 'localhost/yii/blog/rejestracja/loginfb',
				'scope' => array("email")
			));
	    echo "<a href='$log_in_url'>Login</a>";
	    
	}
    }


co robie zle?dodam ze user_id zwraca 0
0

#2 User is offline   afnwork 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 09-May 12

Posted 11 June 2014 - 06:30 AM

Dodaj również z którego rozszerzenia korzystasz ;)
0

#3 User is offline   rad11 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 17-May 14

Posted 11 June 2014 - 06:40 AM

Rozszerzeniem sa poprostu pliki base_facebook.php oraz facebook.php.


Tutaj laduje te pliki jako rozszerzenie
 Yii::import('ext.facebook', true);

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users