Reader API Authentication Error

I am having a problem with the GReader authentication API. I can do HTTPS (https://www.google.com/accounts/ClientLogin) for authentication, and google returns three tokens (SID, LSID, AUTH), but not HSID.

When I try to add a new channel http://www.google.com/reader/api/0/subscription/quickadd?ck=1290452912454&client=scroll with POST data T = djj72HsnLS8293 & quickadd = blog.martindoms.com/feed/without HSID in Cookie, this is the response status code 401. With SID and HSID in Cookie, everything works correctly.

What is and where can I find this HSID string?

Thank you for your responses.

My code is:

public void addNewFeed() throws IOException {
        HttpPost requestPost = new HttpPost("http://www.google.com/reader/api/0/subscription/quickadd?ck=1290452912454&client=scroll");
        getSid();          
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
        DefaultHttpClient client = new DefaultHttpClient();
        requestPost.addHeader("Cookie", "SID=" + _sid + "; HSID=" + _hsid);
        try {
            nameValuePairs.add(new BasicNameValuePair("T", _token));
            nameValuePairs.add(new BasicNameValuePair("quickadd", "blog.martindoms.com/feed/"));
            requestPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            HttpResponse response = client.execute(requestPost);

            InputStream in = response.getEntity().getContent();
            BufferedReader reader = new BufferedReader(new InputStreamReader(in));
            StringBuilder str = new StringBuilder();
            String line = null;

            while ((line = reader.readLine()) != null) {
                str.append(line + "\n");
            }
            System.out.println(str.toString());
            in.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
+3
1

, . Google auth.

getSid() getAuth().

requestPost.addHeader("Cookie", "SID=" + _sid + "; HSID=" + _hsid);

requestPost.addHeader("Authorization", "GoogleLogin auth=" + _auth);
+3

Source: https://habr.com/ru/post/1776527/


All Articles