public function handleProviderCallback(Socialite $social)
    {

        $eve_data = $social->driver('eveonline')->user();

        // Avoid self attachment
        if (auth()->check() && auth()->user()->id == $eve_data->character_id)
            return redirect()->route('home')
                ->with('error', 'You cannot add yourself. Did you forget to change character in Eve Online SSO form ?');

        // Get or create the User bound to this login.
        $user = $this->findOrCreateUser($eve_data);

        // Update the refresh token for this character.
        $this->updateRefreshToken($eve_data);

        if (! $this->loginUser($user))
            return redirect()->route('auth.login')
                ->with('error', 'Login failed. Please contact your administrator.');

        // ensure the user got a valid group - spawn it otherwise
        if (is_null($user->group)) {
            Group::forceCreate([
                'id' => $user->group_id,
            ]);

            // force laravel to update model relationship information
            $user->load('group');
        }

        // Set the main characterID based on the response.
        $this->updateMainCharacterId($user);

        return redirect()->intended();
    }