src/SecucardConnect/Auth/OauthProvider.php
private function pollDeviceAccessToken($deviceCode)
    {
        if (!$this->credentials instanceof DeviceCredentials) {
            throw new ClientError('Invalid credentials set up, must be of type ' . DeviceCredentials::class);
        }

        $this->credentials->deviceCode = $deviceCode;

        $params = [];
        $this->setParams($params, $this->credentials);

        try {
            $response = $this->post($params);
            return MapperUtil::mapResponse($response);
        } catch (Exception $e) {
            // check for auth pending case
            $err = $this->mapError($e, 'Error during device authentication.');
            if ($err instanceof AuthDeniedException && $err->getError() != null && $err->getError()->error ===
                'authorization_pending'
            ) {
                return false;
            }
            throw $err;
        } finally {
            // must reset to be ready for new auth attempt
            $this->credentials->deviceCode = null;
        }
    }
private function pollDeviceAccessToken($deviceCode)
    {
        if (!$this->credentials instanceof DeviceCredentials) {
            throw new ClientError('Invalid credentials set up, must be of type ' . DeviceCredentials::class);
        }

        $this->credentials->deviceCode = $deviceCode;

        $params = [];
        $this->setParams($params, $this->credentials);

        try {
            $response = $this->post($params);
            return MapperUtil::mapResponse($response);
        } catch (Exception $e) {
            // check for auth pending case
            $err = $this->mapError($e, 'Error during device authentication.');
            if ($err instanceof AuthDeniedException && $err->getError() != null && $err->getError()->error ===
                'authorization_pending'
            ) {
                return false;
            }
            throw $err;
        } finally {
            // must reset to be ready for new auth attempt
            $this->credentials->deviceCode = null;
        }
    }
private function pollDeviceAccessToken ( $ deviceCode ) { if ( ! $ this -> credentials instanceof DeviceCredentials ) { throw new ClientError ( 'Invalid credentials set up, must be of type ' . DeviceCredentials :: class ) ; } $ this -> credentials -> deviceCode = $ deviceCode ; $ params = [ ] ; $ this -> setParams ( $ params , $ this -> credentials ) ; try { $ response = $ this -> post ( $ params ) ; return MapperUtil :: mapResponse ( $ response ) ; } catch ( Exception $ e ) { // check for auth pending case $ err = $ this -> mapError ( $ e , 'Error during device authentication.' ) ; if ( $ err instanceof AuthDeniedException && $ err -> getError ( ) != null && $ err -> getError ( ) -> error === 'authorization_pending' ) { return false ; } throw $ err ; } finally { // must reset to be ready for new auth attempt $ this -> credentials -> deviceCode = null ; } }
Function to get access token data for device authorization.
This method may be invoked multiple times until it returns the token data.
@param string $deviceCode The device code obtained by obtainDeviceVerification().
@throws \Exception If a error happens.
@return mixed | boolean Returns false if the authorization is still pending on server side and the access
token data on success.
Function to get access token data for device authorization . This method may be invoked multiple times until it returns the token data .