SleepWalker / hoauth

yii-hoauth provides simple integration with social network authorisation lib Hybridauth in Yii.
Other
59 stars 35 forks source link

facebook error while saving User model #47

Open lpanebr opened 10 years ago

lpanebr commented 10 years ago

First when trying to integrate with facebook I got errors for missing User mode properties:

After I added them to the model and to the DB I got the following error:

Error, while saving User model:

array (
'username' => 
array (
0 => 'Username cannot be blank.',
),
'password' => 
array (
0 => 'Password cannot be blank.',
),
)

What should I do?

SleepWalker commented 10 years ago

you shouldn't use that properties. That was only for demo. You should use only those, you need. HOAuthAction::attributes property used to automatically map your model's properties to the info, that is returned by social network.

about validation error: does username used for login? can you make it not required for registering with hoauth? if yes, than you can create separate scenario for sign-in with hoauth (you can specify this scenario in HOAuthAction::scenario) to make fields password and username not required for social network authorization. In last Yii version you can use 'except' rule property, e.g.

function rules() {
  return array(
    array('password, username', 'required', 'except' => 'hoauth'), // hoauth is you scenario name
    ...
  );
}