concrete/src/Authentication/Type/OAuth/GenericOauthTypeController.php
protected function attemptAuthentication()
    {
        $extractor = $this->getExtractor();

        if (!$this->isValid()) {
            throw new Exception(
                'Invalid account, user cannot be logged in.');
        }

        $user_id = $this->getBoundUserID($extractor->getUniqueId());

        if ($user_id && $user_id > 0) {
            $user = User::loginByUserID($user_id);
            if ($user && !$user->isError()) {
                return $user;
            }
        }

        if ($extractor->supportsEmail() && $user = \UserInfo::getByEmail($extractor->getEmail())) {
            if ($user && !$user->isError()) {
                throw new Exception('A user account already exists for this email, please log in and attach from your account page.');
            }
        }

        if ($this->supportsRegistration()) {
            if ($extractor->getEmail() === null || empty($extractor->getEmail())) {

                /** @var FlashBagInterface $flashbag */
                $flashbag = $this->app->make('session')->getFlashBag();
                if ($this->supportsFullName()) {
                    $flashbag->set('fullName', $this->getFullName());
                } else {
                    $flashbag->set('firstName', $this->getFirstName());
                    $flashbag->set('lastName', $this->getLastName());
                }
                $flashbag->set('username', $this->getUsername());
                $flashbag->set('token', $this->getToken());


                $response = \Redirect::to('/login/callback/' . $this->getHandle() . '/handle_register/', id(new Token())->generate($this->getHandle() . '_register'));
                $response->send();
                exit;

            } else {
                $user = $this->createUser();

                return $user;
            }
        }

        return null;
    }
protected function attemptAuthentication()
    {
        $extractor = $this->getExtractor();

        if (!$this->isValid()) {
            throw new Exception(
                'Invalid account, user cannot be logged in.');
        }

        $user_id = $this->getBoundUserID($extractor->getUniqueId());

        if ($user_id && $user_id > 0) {
            $user = User::loginByUserID($user_id);
            if ($user && !$user->isError()) {
                return $user;
            }
        }

        if ($extractor->supportsEmail() && $user = \UserInfo::getByEmail($extractor->getEmail())) {
            if ($user && !$user->isError()) {
                throw new Exception('A user account already exists for this email, please log in and attach from your account page.');
            }
        }

        if ($this->supportsRegistration()) {
            if ($extractor->getEmail() === null || empty($extractor->getEmail())) {

                /** @var FlashBagInterface $flashbag */
                $flashbag = $this->app->make('session')->getFlashBag();
                if ($this->supportsFullName()) {
                    $flashbag->set('fullName', $this->getFullName());
                } else {
                    $flashbag->set('firstName', $this->getFirstName());
                    $flashbag->set('lastName', $this->getLastName());
                }
                $flashbag->set('username', $this->getUsername());
                $flashbag->set('token', $this->getToken());


                $response = \Redirect::to('/login/callback/' . $this->getHandle() . '/handle_register/', id(new Token())->generate($this->getHandle() . '_register'));
                $response->send();
                exit;

            } else {
                $user = $this->createUser();

                return $user;
            }
        }

        return null;
    }
protected function attemptAuthentication ( ) { $ extractor = $ this -> getExtractor ( ) ; if ( ! $ this -> isValid ( ) ) { throw new Exception ( 'Invalid account, user cannot be logged in.' ) ; } $ user_id = $ this -> getBoundUserID ( $ extractor -> getUniqueId ( ) ) ; if ( $ user_id && $ user_id > 0 ) { $ user = User :: loginByUserID ( $ user_id ) ; if ( $ user && ! $ user -> isError ( ) ) { return $ user ; } } if ( $ extractor -> supportsEmail ( ) && $ user = \ UserInfo :: getByEmail ( $ extractor -> getEmail ( ) ) ) { if ( $ user && ! $ user -> isError ( ) ) { throw new Exception ( 'A user account already exists for this email, please log in and attach from your account page.' ) ; } } if ( $ this -> supportsRegistration ( ) ) { if ( $ extractor -> getEmail ( ) === null || empty ( $ extractor -> getEmail ( ) ) ) { /** @var FlashBagInterface $flashbag */ $ flashbag = $ this -> app -> make ( 'session' ) -> getFlashBag ( ) ; if ( $ this -> supportsFullName ( ) ) { $ flashbag -> set ( 'fullName' , $ this -> getFullName ( ) ) ; } else { $ flashbag -> set ( 'firstName' , $ this -> getFirstName ( ) ) ; $ flashbag -> set ( 'lastName' , $ this -> getLastName ( ) ) ; } $ flashbag -> set ( 'username' , $ this -> getUsername ( ) ) ; $ flashbag -> set ( 'token' , $ this -> getToken ( ) ) ; $ response = \ Redirect :: to ( '/login/callback/' . $ this -> getHandle ( ) . '/handle_register/' , id ( new Token ( ) ) -> generate ( $ this -> getHandle ( ) . '_register' ) ) ; $ response -> send ( ) ; exit ; } else { $ user = $ this -> createUser ( ) ; return $ user ; } } return null ; }
We now check if the user allows access to email address as twitter does not provide this and users can deny access to  on facebook).

@return null|\User

@throws Exception
We now check if the user allows access to email address as twitter does not provide this and users can deny access to on facebook ) .