Deemoore / oauth-signpost

Automatically exported from code.google.com/p/oauth-signpost
0 stars 0 forks source link

Nonsentical stacktrace #43

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Not sure, really... I followed the tutorial on signing in to Google, and
got this stacktrace.

What is the expected output? What do you see instead?
I'm getting an Unexpected response, I can see that from the stacktrace, but
the error I end up with on the lowest level is a FileNotFoundException. I'm
not really sure what I should do with that:

E/Floating Image(22174): Picasa: Error signing in!
E/Floating Image(22174):
oauth.signpost.exception.OAuthCommunicationException: Communication with
the service provider failed:
https://www.google.com/accounts/OAuthGetRequestToken?scope=http%3A%2F%2Fpicasawe
b.google.com%2Fdata
E/Floating Image(22174):    at
oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:21
4)
E/Floating Image(22174):    at
oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.
java:69)
E/Floating Image(22174):    at
dk.nindroid.rss.parser.picasa.PicasaFeeder.signIn(PicasaFeeder.java:46)
E/Floating Image(22174):    at
dk.nindroid.rss.settings.PicasaBrowser.onListItemClick(PicasaBrowser.java:95)
E/Floating Image(22174):    at
android.app.ListActivity$2.onItemClick(ListActivity.java:312)
E/Floating Image(22174):    at
android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/Floating Image(22174):    at
android.widget.ListView.performItemClick(ListView.java:3287)
E/Floating Image(22174):    at
android.widget.AbsListView$PerformClick.run(AbsListView.java:1645)
E/Floating Image(22174):    at
android.os.Handler.handleCallback(Handler.java:587)
E/Floating Image(22174):    at
android.os.Handler.dispatchMessage(Handler.java:92)
E/Floating Image(22174):    at android.os.Looper.loop(Looper.java:123)
E/Floating Image(22174):    at
android.app.ActivityThread.main(ActivityThread.java:4320)
E/Floating Image(22174):    at java.lang.reflect.Method.invokeNative(Native
Method)
E/Floating Image(22174):    at java.lang.reflect.Method.invoke(Method.java:521)
E/Floating Image(22174):    at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/Floating Image(22174):    at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
E/Floating Image(22174):    at dalvik.system.NativeStart.main(Native Method)
E/Floating Image(22174): Caused by: java.io.FileNotFoundException:
https://www.google.com/accounts/OAuthGetRequestToken?scope=http%3A%2F%2Fpicasawe
b.google.com%2Fdata
E/Floating Image(22174):    at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInpu
tStream(HttpURLConnection.java:1061)
E/Floating Image(22174):    at
org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getIn
putStream(HttpsURLConnection.java:252)
E/Floating Image(22174):    at
oauth.signpost.basic.HttpURLConnectionResponseAdapter.getContent(HttpURLConnecti
onResponseAdapter.java:18)
E/Floating Image(22174):    at
oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvi
der.java:228)
E/Floating Image(22174):    at
oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:18
9)
E/Floating Image(22174):    ... 16 more

What version of the product are you using? On what operating system?
Using signpost-core-1.2.1.1. Also added the commons-codec-1.3 for good
measure, but that didn't do much (not sure what it's for, really).

Please provide any additional information below.
This is the code I run:
OAuthConsumer consumer = new DefaultOAuthConsumer(KEY, SECRET);
        OAuthProvider provider = new DefaultOAuthProvider(
"https://www.google.com/accounts/OAuthGetRequestToken?scope=" +
URLEncoder.encode("http://picasaweb.google.com/data", "utf-8"), 
                                                            "https://www.google.com/accounts/OAuthGetAccessToken", 

"https://www.google.com/accounts/OAuthAuthorizeToken?hd=default");

        String authURL = provider.retrieveRequestToken(consumer, OAuth.OUT_OF_BAND);

Original issue reported on code.google.com by bitflips...@gmail.com on 2 May 2010 at 8:56

GoogleCodeExporter commented 9 years ago
For the record, I'm running this on an Android device, and I get the same error 
when
using the provided sample code.

Original comment by bitflips...@gmail.com on 2 May 2010 at 9:22

GoogleCodeExporter commented 9 years ago
Funny, I am refactoring my android app and hit the same issue tonight. But i 
dont
think signpost is to blame.

My old version works fine through all steps of authentication, but my new 
version
gets the same error (though for netflix) I have checked connectivity, and the
generated url,. both are fine.

I am using and older revision of this library, (for both code revisions, 
unrelated
ticket) but it is not the library that I think is the cause, but rather 
Android's
http classes.

Original comment by OlliTech on 4 May 2010 at 10:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Haha, I figured out my issue, which may not be your own.

IN my example I had doen some search and replace after renaming my class. The 
result
was the following changes to my request_token url:
//captial N blows up - file not found
    private static final String REQUEST_TOKEN_ENDPOINT_URL =
"http://api.Netflix.com/oauth/request_token";

Well my guess is that the 'nix kernel in Android sees Netflix.com and 
netflix.com
differently. 

//this works
    private static final String REQUEST_TOKEN_ENDPOINT_URL =
"http://api.netflix.com/oauth/request_token";

And I noticed you have some mixed captials in your google URl, just paste it 
into
your browser and check the case against the URL it returns.

Original comment by OlliTech on 9 May 2010 at 10:10

GoogleCodeExporter commented 9 years ago
Hm, definitely worth investigating. I copied this URL from Google's API, but 
maybe it 
needs to be lowercase. At any rate, the bug stands. I'll return later with an 
update.

Original comment by bitflips...@gmail.com on 9 May 2010 at 10:21

GoogleCodeExporter commented 9 years ago
This happens because https://www.google.com/accounts/OAuthGetRequestToken 
doesn't accept POST requests. Change POST to GET in 
DefaultOAuthProvider.java:40 and you're done.

Original comment by alberto....@gmail.com on 14 Jun 2010 at 1:07