OAuth not working :(

3 views
Skip to first unread message

Oliver Uvman

unread,
Jun 10, 2010, 1:19:48 PM6/10/10
to dyuproject
Hello!

I've got a bit of a problem. When I try to use OAuth I'm getting some
problems. I'm trying to modify the google contact servlet, I've got my
own service provider and such.. Please take a quick look at the code.
I am getting stuck at the highlighted rows (105, 106). The problem is
that my token is in unauthorized, and I can't authorize it because I
don't get any token or verifier from the request. I just don't know
why. At the bottom you also have the code for my token manager, I
tried to emulate the behaviour of HttpSessionManager and
CookieBasedManager as best I could. I don't think the problem is in
the manager, but who knows.

The troublesome code: http://pastebin.com/B7a819AM

Hope you can help, I really want to get this working,
Regards,
Oliver Uvman

Oliver Uvman

unread,
Jun 10, 2010, 1:31:48 PM6/10/10
to dyuproject
Just want to mention that I'm getting the same problem with the
HttpSessionTokenManager.

/Oliver

David Yu

unread,
Jun 10, 2010, 2:03:57 PM6/10/10
to dyupr...@googlegroups.com
Does it fail when you test locally on your machine?
Haven't tried it against twitter yet.
I'll let you know how it goes.

Cheers

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




--
When the cat is away, the mouse is alone.
- David Yu

Oliver Uvman

unread,
Jun 10, 2010, 3:56:54 PM6/10/10
to dyuproject
Yeah, that's when it fails. To be honest I haven't fully understood
the code in the servlet. Have we already gotten to a place when
twitter has to be able to respond back with an http request? In that
case this problem might be solvable by putting this on a server and
running it so the callback can be handled. I've got problems getting
my apps on my server at the moment though, so would be happy if we
could go as far as possible without having to do that. Also, it would
be a pain to have to compile and put things on server just for
testing...

/Oliver
> > dyuproject+...@googlegroups.com<dyuproject%2Bunsubscribe@googlegrou ps.com>
> > .

Oliver Uvman

unread,
Jun 10, 2010, 11:41:13 PM6/10/10
to dyuproject
Gave twitter a callback to my development machine and forwarded
port 8888, still getting the same problem.

/Oliver

David Yu

unread,
Jun 11, 2010, 5:18:12 AM6/11/10
to dyupr...@googlegroups.com
I'm able to get it to work both locally and at appengine. (See attached file)
I've updated the demo to include twitter at http://dyuproject.appspot.com/oauth/

Cheers


To unsubscribe from this group, send email to dyuproject+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/dyuproject?hl=en.

OAuthTwitterService.java

David Yu

unread,
Jun 11, 2010, 6:45:53 AM6/11/10
to dyupr...@googlegroups.com
I suspect it has something to do with your oauth_consumer.properties
I assume you just did a copy/paste from the samples and changed it to a servlet.
Here's my twitter consumer config:

api.twitter.com.consumer_key = your_consumer_key
api.twitter.com.consumer_secret = your_consumer_secret
api.twitter.com.secure = false
api.twitter.com.request_token_url = /oauth/request_token
api.twitter.com.authorization_url = /oauth/authorize
api.twitter.com.access_token_url = /oauth/access_token
api.twitter.com.signature_method = HMAC-SHA1
api.twitter.com.transport_name = POST

You can even try this with the appspot demo in the download section.
Copy the entire OAuthTwitterService.java to its package and add the config above in the oauth_consumer.properties
The first line would look like:
oauth.consumer.endpoint.domains = www.google.com, api.twitter.com

Afterwards, you do a "mvn jetty:run" and access localhost:8080/oauth/twitter/

Hope that helps
Reply all
Reply to author
Forward
0 new messages