hi I'm making an application which let user login with their Facebook account.
-- then after i get their profile such as email address, I store the email address to user table.
but I don't know how to log the user in.
here is my code below.
$fbUser = FacebookService::Instance()->getProfile();
$fbUser = json_decode($fbUser);
if(is_null($fbUser->email)){
$this->Flash->error('We cannot retrieve your email address from Facebook');
}
$user = UserService::Instance()->getUserByEmail($fbUser->email);
session_destroy();
if($this->Auth->setUser($user->toArray())){
$this->Flash->success('Login success with facebook');
}else{
$this->Flash->error('login failed with facebook');
}
$this->set(compact('user'));
after initialize these code, I get login failed with Facebook error.
Please let me know Thank you
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment