protected function registerSocialPlus()
 {
     $this->mergeConfigFrom(__DIR__ . '/../config/socialplus.php', 'socialplus');
     $this->app->singleton('socialplus', function (Application $app) {
         $socialPlus = new SocialPlus($app['session']);
         $socialPlus->setSocialite($this->app->make('Laravel\\Socialite\\Contracts\\Factory'));
         foreach ($this->app['config']->get('socialplus.authorize_handlers') as $identifier => $handler) {
             $socialPlus->registerAuthorizeHandler($identifier, $this->app->make($handler));
         }
         return $socialPlus;
     });
     $this->app->bind('Morrelinko\\SocialPlus\\SocialPlus', function () {
         return $this->app['socialplus'];
     });
 }
 /**
  * @param Request $request
  * @param $provider
  * @return $this
  */
 public function callback(Request $request, $provider)
 {
     $data = $this->socialPlus->getAuthData($provider);
     try {
         $user = $this->socialPlus->getSocialite()->with($provider)->user();
         $data = $this->socialPlus->getAuthData($provider);
         // Prepare token
         $token = property_exists($user, 'tokenSecret') ? implode(':', [$user->token, $user->tokenSecret]) : $user->token;
         $this->socialPlus->setAuthData($provider, array_merge($data, ['token' => $token, 'user' => $user]));
         return $this->socialPlus->getAuthorizeHandler($data['action'])->callback($user, $token, $provider);
     } catch (Exception $e) {
         return $this->socialPlus->getAuthorizeHandler($data['action'])->exception($e, $provider);
     }
 }