if (null == authEntity || !authEntity.getProperty("secret").equals(updateAuth)) {
//if there is no auth key, or the auth key doesn't match the one provided
try {
URLFetchService fetchService = URLFetchServiceFactory.getURLFetchService();
String host = URLEncoder.encode(req.getHeader("Host"), "UTF-8");
HTTPResponse response = fetchService.fetch(new URL(SECURE_HOST + "/auth/?site=" + host + "&auth=" + updateAuth));
if (response.getResponseCode() == 200) {
//if successfully received a response, save the new auth key
String content = new String(response.getContent());
if (content.equals(new String("OK"))) {
authEntity = new Entity(key);
authEntity.setProperty("secret", updateAuth);
datastoreService.put(authEntity);