How to logout & log in as different user?

Issue #20 resolved
Tim Osborn created an issue

Hi, thanks for the work

Scenario:

  • UserA is logged in using LinkedIn
  • hit /anvard/logout
  • user is redirected to /login with a 'logged out' flash message
  • click the login with LinkedIn button
  • UserA is automatically authenticated without requiring reauthorisation

How can UserB log in using LinkedIn?

UserA could go to their linked in settings and un-authorise the app, but that's obviously impractical :)

I've tried the 'anvard/logout' route and have also tried adding the following to my /logout route:

Route::get('/logout', function() {

    $hybridAuth = App::make('hybridauth');
    $hybridAuth->logoutAllProviders();

    // this not working either :(
    // if(Auth::check()) {
    //     Auth::user()->remember_token = NULL;
    // }

    Auth::logout();
    Session::flush();
    return Redirect::route('login')->with('success', 'You\'ve been Logged Out');
});

As you can see.. I'm just trying it all :)

Here's an issue I found at hybridauth: https://github.com/hybridauth/hybridauth/issues/220

Thanks in advance, Tim

Comments (3)

  1. Tim Osborn reporter

    my mistake… i need to log out of my provider (linkedin, etc) to allow another user to log into my app.

  2. Log in to comment