1
AuthSub 토큰을 수신하고이를 사용하여 Google에서 모든 연락처를 검색합니다. 코드는 Google Contacts API 사용 중 인증 헤더 정보가 없습니다. Java
try {
URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/base?max-results=" + maxresult);
ContactsService service = new ContactsService("Google-contactsExampleApp-1");
service.setAuthSubToken(sessionToken, getPrivateKey());
ContactFeed resultFeed = service.getFeed(feedUrl, ContactFeed.class);
ArrayList<UserContact> ucList = new ArrayList<UserContact>(resultFeed.getEntries().size());
for (ContactEntry entry : resultFeed.getEntries()) {
if (entry == null || entry.hasDeleted()) {
continue;
}
ucList.add(parseEntry(entry));
}
return ucList;
} catch (Exception e) {
LOGGER.log(Level.WARNING, null, e);
return null;
}
을 니펫을하지만 오류가 아래에 무엇입니까 :
java.lang.NullPointerException: No authentication header information
at com.google.gdata.util.AuthenticationException.initFromAuthHeader(AuthenticationException.java:96)
at com.google.gdata.util.AuthenticationException.<init>(AuthenticationException.java:67)
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:600)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.Service.getFeed(Service.java:1135)
at com.google.gdata.client.Service.getFeed(Service.java:998)
at com.google.gdata.client.GoogleService.getFeed(GoogleService.java:631)
at com.google.gdata.client.Service.getFeed(Service.java:1017)
아직 oauth로 이동하지 않았습니다. 이것이 문제입니다. AuthSubtoken에 대해서는 어떤 자격 증명을 설정할 지 알 수 없습니다. 답변 해 주셔서 감사합니다. – shoekan