You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to be able to get a Facebook user's information within the beforeRender method and the only way I've been able to do this is using the following method. Is there a better way?
$this->Connect->setAccessToken($this->current_user['facebook_oauth_token']); //Try to reset the oauth token
$this->Connect->uid = $this->current_user['facebook_id'];
$this->Connect->initialize($this);
$this->Connect->startup($this);
$this->facebook_user = $this->Connect->user();
The text was updated successfully, but these errors were encountered:
to solve that i've created a Session Variable within the beforeRender of the AppController:
if($this->Auth->loggedIn()){
$id = $this->Auth->user('id');
$logged_user = $this->User->findById($id); //knowing that i've saved all the user details i've grabbed from Facebook in the users table
$this->Session->write('LoggedUser', $logged_user);
}
this way you can call it from any method of any controller.
of course, don't forget to do "$this->Session->destroy();" upon logout.
I'd like to be able to get a Facebook user's information within the beforeRender method and the only way I've been able to do this is using the following method. Is there a better way?
The text was updated successfully, but these errors were encountered: