Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Request in postXAuth #102

Open
vt-ombalakumar opened this issue Feb 8, 2017 · 5 comments
Open

Bad Request in postXAuth #102

vt-ombalakumar opened this issue Feb 8, 2017 · 5 comments

Comments

@vt-ombalakumar
Copy link

Inside preExecute of AyncTask Android

 client = new JumblrClient(
                        "consumer key ",
                        "consumer key secret"
                );
                client.setToken(
                    "tokey key",
                    "token key secret"
            );
             @Override
        protected String doInBackground(String... params) {             
            return posts(client);
        }    
 private String posts(JumblrClient client) {
        try{
        Token token = client.getRequestBuilder().postXAuth(username, password);  //1. goes here
        if (token != null) {
            client.setToken(token);
        }
       }catch (JumblrException exc){
            exc.printStackTrace();
        }catch (OAuthConnectionException oas){
            Log.e("tag: ","OExec");
            oas.printStackTrace();
        }catch(RuntimeException rexc){
            Log.e("tag: ","RExc");
            rexc.printStackTrace();
        }
       return "Success";
       }` 
Token clearXAuth(Response response) {
        if (response.getCode() == 200 || response.getCode() == 201) {
            return parseXAuthResponse(response);
        } else {
            throw new JumblrException(response);
        }
    }

Response Header which I am getting in response* is
"null" -> "HTTP/1.1 400 Bad Request"
"Set-Cookie" -> "tmgioct=589b08808216570049410250; expires=Sat, 06-Feb-2027 12:01:04 GMT; Max-Age=315360000; path=/; domain=.tumblr.com; HttpOnly"
"X-Android-Response-Source" -> "NETWORK 400"
"Connection" -> "keep-alive"
"X-Android-Sent-Millis" -> "1486555264206"
"Content-Type" -> "text/html; charset=UTF-8"
"P3P" -> "CP="Tumblr's privacy policy is available here: https://www.tumblr.com/policy/en/privacy""
"Date" -> "Wed, 08 Feb 2017 12:01:04 GMT"
"X-Content-Type-Options" -> "nosniff"
"Server" -> "openresty"
"Transfer-Encoding" -> "chunked"
"X-XSS-Protection" -> "1; mode=block"
"X-Frame-Options" -> "deny"
"X-Android-Received-Millis" -> "1486555264614"

@ArcherN9
Copy link

xAuth is not available for all applications. You may contact Tumblr Support at support[@]tumblr[.]com and request it. Once enabled, You'll stop receiving 400 HTTP status codes.

@vt-ombalakumar
Copy link
Author

Oh, OK and thanks for the fast reply @dakshsrivastava

@miterial
Copy link

miterial commented May 3, 2019

could you please write in your readme AND javadoc that xAuth is not available for all applications? it took me hours trying to figure out why public function just won't work!

@ArcherN9
Copy link

ArcherN9 commented May 4, 2019

@miterial Check my comment here from 2017.

@miterial
Copy link

miterial commented May 4, 2019

yes, of course I saw it, that's why I asked to mention it not only in 2017 comment in project issues, but also on main readme page to let other developers know about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants