无法验证tumblr

时间:2012-09-28 07:40:46

标签: android authentication authorization tumblr

我使用了链接https://github.com/FredrikL/android-ttTumblr中提到的代码。当我使用此代码时,我无法验证用户名和密码。可以任何人帮助我PLZ ..以下代码是用于验证tumblr

HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(
                "http://www.tumblr.com/api/authenticate");

        try {
            System.out.println("user name : "+Username);
            System.out.println("password : "+Password);
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("email", Username));
            nameValuePairs.add(new BasicNameValuePair("password", Password));

            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            HttpResponse response = httpclient.execute(httppost);
            System.out.println("response value : "+ response.toString());
            System.out.println("response entity : "+response.getStatusLine().toString());
            System.out.println(response.getStatusLine().getStatusCode());
            if (response.getStatusLine().getStatusCode() != 200) {
                return false;
            }
            // Save our list of available blogs.
            SharedPreferences blogs = this.context.getSharedPreferences(BLOGS_PREFS,
                    0);
            Log.d("ttT", "attempting blog list extraction");
            saveBlogList(response, blogs);
            return true;

        } catch (ClientProtocolException e) {
            Log.d(TAG, "client proto exception", e);
        } catch (IOException e) {
            Log.d(TAG, "io exception", e);
        }
        return false;

在这里我得到“response.getStatusLine()。getStatusCode()值是404”。任何人都可以帮我验证它。

1 个答案:

答案 0 :(得分:0)

http://www.tumblr.com/api/authenticate不存在。因此,你得到一个HTTP404。

见这个

http://www.tumblr.com/docs/en/api/v2