Search code examples
rubytwitteroauthgrackle

Twitter OAuth Request Token Using Grackle


I am currently trying to use the Grackle Ruby GEM to integrate with the Twitter API, but I have encountered a little snag.

I am attempting to perform a GET to twitter.com/oauth/request_token, but according to the OAuth spec I need to provide the following values:

  • oauth_consumer_key
  • oauth_signature_method
  • oauth_signature
  • oauth_timestamp
  • oauth_nonce

I am a little stumped, as at this point Twitter has only given me a Consumer Key and a Consumer Secret. Am I just going about this the hard way? Because I cannot figure out how to correctly populate those values. No matter what I supply Twitter keeps returning:

Failed to validate oauth signature and token

It sounds like my problem is just a general misunderstanding on how to properly integrate with Twitter and OAuth in general, and not so much the specifics of Grackle... but perhaps too much information is best in this case :-)


Solution

  • First of all, you should probably be reading the latest OAuth rev, which is 1.0a. There are no differences when obtaining the request token though so you should be fine in that regard.

    Apart from that, it looks like a combination of general misunderstanding of the OAuth process and the scope of Grackle:

    The process of acquiring the access token and token secret are outside the scope of Grackle and will need to be coded on a per-application # basis. Grackle comes into play once you've acquired all of the above pieces of information (source).

    So, I would first look towards a library that can get you an access token before continuing with Grackle. Moomerman's twitter_oauth looks like a good choice: http://github.com/moomerman/twitter_oauth

    Hope that helps!