CakePHP, Opauth and Auth component
Hello there,
I have a question regarding Opauth and Cakephp. I am just starting new project and I decided to go with Opauth and few Strategies to develop login system. But, I have a problem, I cannot login user with Auth component from CakePHP. It works nice, I get array of data from social network, but I cannot login user with Auth component. I have tried to debug to see whats happening, but I cannot see the problem.
$this->Auth->login() ::: not working
$this->Auth->login($this->request->data['User']) :: not working
I have tried to manipulate with $this->request->data like this:
if ($this->data['auth']['provider'] == 'Google') {
//try to find google user
$g_id = $this->data['auth']['uid'];
$gu = $this->User->find('first', array('conditions' => array('User.g_id' => $g_id), 'recursive' => -1));
if ($gu['User']['g_id']) {
$this->request->data['User'] = $gu['User'];
$this->request->data['User']['password'] = $gu['User']['g_id'];
if ($this->Auth->login($this->request->data['User'])) {
$this->Session->setFlash(__('You have successfully logged in.'), 'flash_success');
return $this->redirect('/');
} else {
$this->Session->setFlash(__('Something went wrong while login process. Please try again.'), 'auth_error');
return $this->redirect('/');
}
} else {
//get data for registration
}
And I just cannot succeed to login user. Also I have added into AppController to beforeFilter:
$this->Auth->authenticate = array(
AuthComponent::ALL => array('userModel' => 'User'),
'Form',
'Basic'
);
So, if you can help me with this, I would be very grateful!
P.S. just to mention, Login form through normal post data is working.
Greets
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 post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home