Skip to content

Auth::attemp() failing to persist logged in status. #137

Description

@tobz-nz

I'm having an issue where Auth::attemp() is not persistently logging the user in.

My code that doesn't work:

if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')), Input::get('remember'))) {
    print_r(Auth::user()); // prints user data
    return Redirect::route('home');

    // redirects back to login form because:
    print_r(Auth::user()); // null
}

Hack that does work:

if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input::get('password')), Input::get('remember'))) {

    // manually log user in
    Auth::login(Auth::user());

    print_r(Auth::user()); // prints user data
    // after redirect
    print_r(Auth::user()); // still prints user data
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions