I am confused with third party login

3518 views php

I am a new php coder. I use fb login as a third party. I am success to get some user data from the fb, but i got some error in creating the new user of the db.

password dosent have a default value

What data should be inserted in the password field?

facebookcallback function

  public function handleFacebookCallback()
    try {
        $user = Socialite::driver('facebook')->user();
        $create['name'] = $user->getName();
        $create['email'] = $user->getEmail();
        $create['facebook_id'] = $user->getId();
        $creaet['memberId'] = $user->getId();

        $userModel = new User;
        $createdUser = $userModel->addNew($create);

        return redirect()->route('/loginsucces');

    } catch (Exception $e) {

        return redirect('/');


I found some information on the Internet, and I know i got the accessToken in the facebook callback. Then i use this token


to ask facebook to get some user information. Then the web login process with fb checks whether the database has user data.

If no, new user data is created. However, the error is happened in the create.

OMG !!!! I didnt insert any data of the password field.

I cant find any answer on the internet.

Have anyone can help me to resolve this problem?

answered question

3rd party login means your site will never know the password of the 3rd party site ( facebook, google etc )

2 Answers


In you users database migration file, make password field nullable. Like this


That would not show error on password anymore because we have made it optional when creating user with nullable.

Hope this helps you.

posted this

Try to pass insert password when u created new user from facebook. And make sure your database column password allow null value, so new user created withouy password

posted this

Have an answer?


Please login first before posting an answer.