lundi 16 avril 2018

RedirectResponse does not redirect the user. Laravel5

I want to redirect the user if his Facebook login token is expired. However, the redirect response does not redirect the browser.

This is the code that redirects:

catch ( FacebookSDKException $e ) {
            //catch exception is token is expired

            //redirect to facebook login
            app('App\Http\Controllers\Auth\SocialiteLoginController')->redirectToProvider('facebook');
        }

This is the redirectToProvider method:

public function redirectToProvider($provider)
{
    $this->validateProvider($provider);

    if ($provider === 'facebook') {
        return Socialite::driver($provider)->scopes([
            'email',
            'public_profile',
            'rsvp_event',
            'user_about_me',
            'user_birthday',
            'user_events',
            'user_friends',
        ])->redirect();
    }
    dd(Socialite::driver($provider)->redirect());
    return Socialite::driver($provider)->redirect();
}

I can see the result of dd being the HTML content the user is supposed to be redirected to. When I remove the dd the code proceeds without any browser redirect.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire