Exemple #1
0
 /**
  * When the user has authenticated it will return to this route.
  *
  * @param Authentication $authentication
  * @param $driver
  * @return \Illuminate\Http\RedirectResponse
  */
 public function callback(Authentication $authentication, $driver)
 {
     if (!in_array($driver, $this->availableProviders)) {
         return abort(404);
     }
     app()->configure('services');
     try {
         $socialiteUser = $this->socialite->driver($driver)->user();
         $authentication->loginOrCreateUser($socialiteUser, $driver);
         return redirect('/');
     } catch (Exception $e) {
         return redirect('login-failed');
     }
 }