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

Already on GitHub? Sign in to your account

Error: Authentication error: Unable to respond to any of these challenges: {} #2

Open
ceefour opened this Issue Dec 23, 2010 · 12 comments

Comments

Projects
None yet
4 participants

ceefour commented Dec 23, 2010

The client is only for Java ME, not Java SE.

After porting to Java SE (see https://github.com/ceefour/messenger-sdk), it builds but I got a runtime error:

HTTP GET SENT:
http://stage.rest-core.msg.yahoo.com/v1/session?&realm=yahooapis.com&oauth_consumer_key=************&oauth_version=1.0&oauth_signature=********
2010-12-24 01:11:27 DefaultHttpClient [WARN] Authentication error: Unable to respond to any of these challenges: {}
ERROR HTTP RETURN CODE IS: 401
ERROR HTTP BODY IS: {"error":{"code":4,"detail":"Invalid Cookies Error","description":"Invalid Cookies Error"},"code":4}

I'm also getting the same error. You mean it's not possible to use the library apart from Java ME? What could be the reason for that?

aldrinm commented Apr 27, 2012

There are 2 forks which were SE ports:
https://github.com/ceefour/messenger-sdk
https://github.com/aldrinm/messenger-sdk

You may to check which ones work for you

I've tried ceefour's fork, but as he said on the Readme text, it's not working.

I've tried your fork just now, I can get the RequestToken however I get this error:

java.io.IOException: Server returned HTTP response code: 401 for URL:
https://api.login.yahoo.com/oauth/v2/get_token?&oauth_consumer_key=***--&oauth_signature_method=PLAINTEXT
&oauth_nonce=123456&oauth_timestamp=1335519354&oauth_signature=_%26
&oauth_version=1.0
&oauth_token=
_
--

Have you tried your fork to work with logging in with the yahoo server? Or this is still under development.

aldrinm commented Apr 27, 2012

I just tried my code now and I get the same 401 error as yours. I'm damn sure this worked 6 months ago!

ceefour commented Apr 27, 2012

I hate to say this...but try jYMSG.

IIRC its the one I ended up using and worker.
On Apr 27, 2012 6:01 PM, "aldrinm" <
reply@reply.github.com>
wrote:

I just tried my code now and I get the same 401 error as yours. I'm damn
sure this worked 6 months ago!


Reply to this email directly or view it on GitHub:
yahoo#2 (comment)

@aldrinm If it works before, then perhaps Yahoo has made changes with the API? The URL? Any ideas why it does not work anymore?

aldrinm commented Apr 27, 2012

oh i just managed to get it working. my consumer key and secret were all wrong. please re-check the values in the YahooMessengerConstants . And use TestYahoo.java for testing it out.

I tried using TestYahoo with the updated authenticationConsumerKey and authenticationConsumerSecret still getting: HTTP response code: 401 for URL, are there any other settings that needs updating?

aldrinm commented Apr 28, 2012

Make sure you are updating the YahooMessengerLibraries / src / com / yahoo / messenger / util / YahooMessengerConstants.java and this file is in the classpath first. There is another YahooMessengerConstants in the build folder. It is possible that the other one is being run instead. Or you can just make that the build file has the same contents are the src file.

Try debugging the generate http url (printed on the console) and observe the response. I normally use HttpFox on Firefox

I'm not using Firefox, I'm just running the TestYahoo.java from Eclipse

Hey...

Try using the AssyncHttpClient loopj.com library.

String userpass = "user:pass";
String encoded = new String(Base64.encode(userpass.getBytes(),Base64.NO_WRAP));
TextView txtObject = (TextView) findViewById(R.id.jSonField)
AsyncHttpClient client = new AsyncHttpClient();
client.addHeader("Authorization", "Basic "+encoded);
client.get(url, new AsyncHttpResponseHandler() 
{
            @Override
            public void onSuccess(String content) {
                super.onSuccess(content);

                try {

                    JSONObject obj = new JSONObject(content);

                    txtObject.setText(obj.getString("jSonField"));

                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show();
                    e.printStackTrace();
                }
            }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment