Laravel 4 Auth with Facebook (no password authentication)

后端 未结 2 1290
死守一世寂寞
死守一世寂寞 2021-01-22 18:47

I\'m trying to set up an authentication system with Laravel 4 with a Facebook login. I am using the madewithlove/laravel-oauth2 package for Laravel 4.

Of course, ther

2条回答
  •  难免孤独
    2021-01-22 19:43

    You have to implement UserInterface to your model for Auth to work properly

    use Illuminate\Auth\UserInterface;
    class Fan extends Eloquent implements UserInterface{
    ...
    public function getAuthIdentifier()
    {
        return $this->getKey();
    }
    
    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->password;
    }
    }
    

    getAuthIdentifier and getAuthPassword are abstract method and must be implemented in you class implementing UserInterface

提交回复
热议问题