0

laravel 6 redirect back to the previous page after login using socialite package. How can I achieve this with the following code?

     protected function redirectTo(){
       return url()->previous();
     }



  public function handleProviderCallback($provider)
   {
    try {
    $social_user = Socialite::driver($provider)->user();
    $authuser = $this->findOrCreateUser($social_user,$provider);

    Auth::login($authuser,true);

    return redirect($this->redirectTo());
  } catch(\Exception $e){

    return redirect($this->redirectTo());
}


}
Upasana Chauhan
  • 948
  • 1
  • 11
  • 32

0 Answers0