[oauth] Java OAuthClient.access() fails due to redirect

2010-11-16 Thread droidin.net
I'm trying to obtain authentication URL using Java 4 OAuth. When I do
OAuthClient.invoke() call it throws OAuthException since response
returns 302 code. I'm using OAuthClient.access() call instead but now
I'm finding out that when I'm trying access any protected resources
302 also frequently occurs. My question is how to deal properly with
redirects since I'm using all types of request (GET, POST and PUT to
be exact) and it looks like I can't rely on OAuthClient.invoke() to do
so

-- 
You received this message because you are subscribed to the Google Groups 
OAuth group.
To post to this group, send email to oa...@googlegroups.com.
To unsubscribe from this group, send email to 
oauth+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/oauth?hl=en.



[oauth] Java OAuthClient.access

2009-01-30 Thread John Kristian

I propose to extend the Java oauth-core library to better support
accessing protected resources, as follows.  Please let me know if this
is a bad idea, or there's a better way.

In brief, I propose to add a method to OAuthClient:

/** Send a request and return the response. */
public OAuthResponseMessage access (OAuthMessage request,
ParameterStyle style) throws IOException;

Unlike the existing 'invoke' method, it won't try to decide whether
the response indicates success; it will merely return the response.  A
typical caller would evaluate the response, something like this:

OAuthClient client = ...;
OAuthAccessor accessor = ...;
OAuthMessage request = new ...;
request.addRequiredParameters (accessor);
OAuthResponseMessage response = client.access (request,
ParameterStyle.AUTHORIZATION_HEADER);
switch(response.getHttpResponse().getStatusCode()) {
  case 200: ...
  case 400: ...

I'm a little worried about feature creep: this is a step toward a
general purpose HTTP client library.  But it's a tolerably small step,
I hope.  I don't want to try to reproduce all the features of the
Apache HTTP client libraries.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
OAuth group.
To post to this group, send email to oauth@googlegroups.com
To unsubscribe from this group, send email to oauth+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/oauth?hl=en
-~--~~~~--~~--~--~---