protected void prepareAuthenticationHeaders(HttpRequestBase request) throws Exception {
		if (grantToken == null && username != null && password != null) {
			FetchGrantService fgs = new FetchGrantService(username, password);				
			executeService(fgs);
			grantToken = fgs.getResult().getAccessToken();
			username = null; //no need to store now
			password = null;
		}
		
		if (grantToken == null) {
			throw new RuntimeException("Authentication required but no credentials available");
		}
		
		if (token == null || token.isExpired()) {
			FetchTokenService fts = new FetchTokenService(grantToken);
			executeService(fts);
			token = fts.getResult();
		}
		
		request.addHeader("X-Authorization", "Access_Token access_token=" + token.getAccessToken());
	}