Redirect to URL after login with Socialite in Laravel
<p>I need to register in a tournament with the URL:</p>

<pre><code>http://laravel.dev/tournaments/1/register/
</code></pre>

<p>This URL is in the middleware 'auth', so if the user is not logged, he is redirected to login page.</p>

<p>What I need is to redirect to</p>

<pre><code>http://laravel.dev/tournaments/1/register/
</code></pre>

<p>After social login ( I have 2 providers, fb and google)</p>

<p>In this case, I don't want the user to be redirected to the redirected url defined in .env</p>

<p>This is the function I use to login with Socialite:</p>

<pre><code>public function execute($request, $listener, $provider) {

    if (!$request) {

        return $this-&gt;getAuthorizationFirst($provider);
    }
    $user = $this-&gt;users-&gt;findByUserNameOrCreate($this-&gt;getSocialUser($provider), $provider);
    if (!is_null($user)){
        $this-&gt;auth-&gt;login($user, true);
    }else{
        Session::flash('error', Lang::get('auth.account_already_exists'));
        return redirect('auth/login');
    }


    return $listener-&gt;userHasLoggedIn($user);
}
</code></pre>

<p>How can I do to make the system redirect me to the initial action and not the default redirect_url param.</p>

<p>I have it resolved with normal login with the guest() function, but I don't know how to implement it in this case.</p>

<p>Problem is quite similar to this <a href="https://stackoverflow.com/questions/30487429/laravel-5-and-socialite-new-redirect-after-login">post</a></p>