protected function getRefreshToken(){
		// check if RefreshToken is already stored
		$refreshToken = $this->getConfig()->getStorage()->getRefreshToken();
		if(null !== $refreshToken){
			return $refreshToken;
		}
		
		// get device token required for RefreshToken request
		$deviceToken = $this->getDeviceToken();
		if($deviceToken !== null && $deviceToken->canPoll()){
			// check if token exists and can be polled (depends on interval provided by the server)
			$params = array(
				'client_id' => $this->getConfig()->getClientId(),
				'code' => $deviceToken->getDeviceCode(),
				'grant_type' => 'device',
			);
			// request a RefreshToken
			$response = $this->sendPostRequest("oauth2waitress/oauth2.svc/token", $params);
			$output = $response['output'];
			$httpcode = $response['code'];
			
			// update LastPoll date to assure the correct polling interval
			$deviceToken->setLastPoll(new DateTime());
			$this->getConfig()->getStorage()->saveDeviceToken($deviceToken);
			
			switch($httpcode){
				case "200" : 
					$responseObject = json_decode($output);
					if(empty($responseObject->access_token)){
						// no AccessToken provided yet. Authorization is most likely pending.
						return null;
					}
					// AccessToken provided
					// create AccessToken and save it
					$accessToken = new AccessToken(new DateTime(), $responseObject->access_token, $responseObject->token_type, $responseObject->expires_in);
					$this->getConfig()->getStorage()->deleteAccessToken();
					$this->getConfig()->getStorage()->saveAccessToken($accessToken);
					if($responseObject->refresh_token){
						// if a RefreshToken was also provided, we create and save it, too.
						$refreshToken = new RefreshToken(new DateTime(), $responseObject->refresh_token);
						$this->getConfig()->getStorage()->saveRefreshToken($refreshToken);
					}
					return $refreshToken;
			}
		}
		return null;
	}