2011-07-29 10 views
0
public void getToken() { 

    BasicClientCookie cookie = new BasicClientCookie("SID", sid); 
    cookie.setPath("/"); 
    cookie.setDomain(".google.com"); 

    CookieStore store = new BasicCookieStore();   
    store.addCookie(cookie); 

    String url = "http://www.google.com/reader/api/0/token"; 

    HttpClient httpclient = new DefaultHttpClient(); 
    HttpGet req = new HttpGet(url); 

    ((DefaultHttpClient)httpclient).setCookieStore(store); 

    try { 
     token = httpclient.execute(req, Misc.StringRespHandler); 
    } catch (ClientProtocolException e) { 
     e.printStackTrace(); 
    } catch (IOException e) { 
     e.printStackTrace(); 
    } 
} 

Google 리더에 연결하려고합니다.Google 리더 테스트 코드에서 무엇을 놓치셨습니까?

SID 가져 오기가 성공했습니다. 그래서 SID 쿠키를 만들고 토큰을 얻으려고했지만 실패했습니다 (403 금지됨).

잘못된 방법입니까?

Apache HttpClient 라이브러리를 사용했습니다.

답변

관련 문제