Example #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');
     }
 }
Example #2
0
 /**
  * Get value from session by key.
  *
  * @param  string   $key
  * @param  boolean  $remove Optional
  *
  * @return mixed|null
  */
 protected function getFromSession($key, $remove = true)
 {
     $value = parent::getFromSession($key, $remove);
     return unserialize($value);
 }