orchestral / auth

Auth Component for Orchestra Platform
MIT License
23 stars 5 forks source link

Argument 1 passed to Illuminate\Auth\Guard::login() must implement interface Illuminate\Auth\UserInterface, null given, called in /home/keebo-dev/vendor/laravel/framework/src/Illuminate/Auth/Guard.php on line 385 and defined #26

Closed ronnievisser closed 10 years ago

ronnievisser commented 10 years ago

Hi,

I am getting above error when trying to login using Auth::loginUsingId( 1);

Any thoughts on this?

crynobone commented 10 years ago

Are you able to use it without orchestra/auth? We don't overload that method

ronnievisser commented 10 years ago

Yep I am!

crynobone commented 10 years ago

Odd, I can't reproduce this.

Route::get('foo', function () {
    Auth::loginUsingId(1);

    return Auth::user()->fullname;
});

Just work on my end. Can you parse your app/config/auth.php, and full code that you use.

And pass also your User model.

ronnievisser commented 10 years ago

return array(

    /*
    |--------------------------------------------------------------------------
    | Default Authentication Driver
    |--------------------------------------------------------------------------
    |
    | This option controls the authentication driver that will be utilized.
    | This driver manages the retrieval and authentication of the users
    | attempting to get access to protected areas of your application.
    |
    | Supported: "database", "eloquent"
    |
    */

    'driver' => 'eloquent',

    /*
    |--------------------------------------------------------------------------
    | Authentication Model
    |--------------------------------------------------------------------------
    |
    | When using the "Eloquent" authentication driver, we need to know which
    | Eloquent model should be used to retrieve your users. Of course, it
    | is often just the "User" model but you may use whatever you like.
    |
    */

    'model' => 'User',

    /*
    |--------------------------------------------------------------------------
    | Authentication Table
    |--------------------------------------------------------------------------
    |
    | When using the "Database" authentication driver, we need to know which
    | table should be used to retrieve your users. We have chosen a basic
    | default value but you may easily change it to any table you like.
    |
    */

    'table' => 'users',

    /*
    |--------------------------------------------------------------------------
    | Password Reminder Settings
    |--------------------------------------------------------------------------
    |
    | Here you may set the settings for password reminders, including a view
    | that should be used as your password reminder e-mail. You will also
    | be able to set the name of the table that holds the reset tokens.
    |
    | The "expire" time is the number of minutes that the reminder should be
    | considered valid. This security feature keeps tokens short-lived so
    | they have less time to be guessed. You may change this as needed.
    |
    */

    'reminder' => array(

        'email' => 'emails.auth.reminder',

        'table' => 'password_reminders',

        'expire' => 60,

    ),

);

I am doing exact what you do in your example. Did I forgot something in my auth config?

crynobone commented 10 years ago

@Ronster are you referring to http://lembubintik.com/posts/managing-laravel-users-with-orchestra-auth-part-one?

Do you have class User extends \Orchestra\Model\User {}? because https://github.com/orchestral/model/blob/master/src/Orchestra/Model/User.php are the one that implements Illuminate\Auth\UserInterface.

ronnievisser commented 10 years ago

Yes that is what I have


use Orchestra\Model\User as Eloquent;

class User extends Eloquent {   

}
crynobone commented 10 years ago

Okay, I can get this error if I'm login to an incorrect user id. Say Auth::loginUsingId(100000000);. I would presume this is an expected behaviour if you're trying to login using an invalid ID.

ronnievisser commented 10 years ago

I do have a user with an id of 1 in my user table so the user does exists

crynobone commented 10 years ago

Here a test app I just create, basic install with just a db seed. https://github.com/testbench/laravel/tree/playground-1

valid-login route work as expected for my end.

ronnievisser commented 10 years ago

Cool, i Will take a look at this tomorrow. 

Thanks — Sent from Mailbox for iPhone

On Thu, Jan 16, 2014 at 10:24 PM, Mior Muhammad Zaki notifications@github.com wrote:

Here a test app I just create, basic install with just a db seed. https://github.com/testbench/laravel

valid-login route work as expected for my end.

Reply to this email directly or view it on GitHub: https://github.com/orchestral/auth/issues/26#issuecomment-32548547

ronnievisser commented 10 years ago

Well I have used your testbench but still getting the same error. for both the invalid and valid login routes.. I have checked my DB connection and users table and all is setup correctly.

On 16 January 2014 22:57, Ronnie Visser ronsterdj@gmail.com wrote:

Cool, i Will take a look at this tomorrow.

Thanks — Sent from Mailbox https://www.dropbox.com/mailbox for iPhone

On Thu, Jan 16, 2014 at 10:24 PM, Mior Muhammad Zaki < notifications@github.com> wrote:

Here a test app I just create, basic install with just a db seed. https://github.com/testbench/laravel

valid-login route work as expected for my end.

— Reply to this email directly or view it on GitHubhttps://github.com/orchestral/auth/issues/26#issuecomment-32548547 .

crynobone commented 10 years ago

@Ronster can you share your environment, Db type & version, PHP version and OS.

crynobone commented 10 years ago

Any update on this?

ronnievisser commented 10 years ago

I couldn't get it to work so I stopped and will try later or I switch to something else — Sent from Mailbox for iPhone

On Thu, Jan 30, 2014 at 5:04 PM, Mior Muhammad Zaki notifications@github.com wrote:

Closed #26.

Reply to this email directly or view it on GitHub: https://github.com/orchestral/auth/issues/26