Skip to content

It's not an issue but seeking help on getting and saving user data while facebook login. #169

@sagarguhe

Description

@sagarguhe

In my application I have three users and each user having their own model which manages their login. I am using prefixes to change the Auth user model dynamically in beforefilter, so each and every user can access only those methods which have their respective user prefix, say admins login is managed through Admin Model, students Model authenticate Students, and Institute user login through Institute Model. However the cake Auth and also Nicks plugin works perfectly. But plugin saves only facebook_id and password. I also used the:

//Add an email field to be saved along with creation.
function beforeFacebookSave(){
$this->Connect->authUser['User']['email'] = $this->Connect->user('email');
return true; //Must return true or will not save.
}

but nothing happened and when I refreshed the page it threw the SQL Integrity Constraint error saying email must not be NULL. When I removed this method after refresh I get redirected to the after login page of my application, which was expected without refresh.

Now I want to get and save email, Name, gender of the user, also I have set the public_profile, email 'perms' for facebook login button. Where is the problem I am not able to figure out.

P.S. I have set the component and helper in Model controller and not in AppController.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions