I am trying to authenticate with google api using this snippet:
RestTemplate restTemplate = new RestTemplate(); List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>> restTemplate.getMessageConverters()); converters.add(new PropertiesHttpMessageConverter()); restTemplate.setMessageConverters(converters); Properties result = preparePostTo(AUTHENTICATION_URL) .using(restTemplate) .expecting(Properties.class) .withParam("accountType", "HOSTED_OR_GOOGLE") .withParam("Email", email) .withParam("Passwd", password) .withParam("service", "reader") .withParam("source", "google-like-filter") .execute(); String token = (String) result.get("Auth");
Now I have a token like: DQAAAI ... kz6Ol8Kb56_afnFc (over 100 characters) and try to get the URL:
URL url = new URL(LIKERS_URL + "?i=" + id); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); connection.addRequestProperty("Authorization", "GoogleLogin Auth=" + token); return url;
But while I get content using this URL, I get a 401 Client Error exception. What could it be?
In accordance with this issue , the Google Reader authentication problem should all be fine.
I can get the content by simply pasting the URL into the browser.
source share