Autopen is a Ruby gem that writes your (OAuth) signatures for you.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Code Climate


Autopen writes your (OAuth) signatures for you. That's all it does. Simple.


Add this line to your application's Gemfile:

gem 'autopen'

And then execute:

$ bundle

Or install it yourself as:

$ gem install autopen


require 'autopen'
signature = METHOD, URL, POST_PARAMS, {:consumer_key => "YOUR CONSUMER KEY", :consumer_secret => "YOUR CONSUMER SECRET", :version => "1.0 (probably)", :timestamp =>, :nonce => "YOUR NONCE HERE", :token => "YOUR TOKEN, IF YOU HAVE ONE. OTHERWISE DON'T INCLUDE THIS VALUE AT ALL.", :token_secret => "YOUR TOKEN SECRET, IF YOU HAVE ONE. OTHERWISE DON'T INCLUDE THIS VALUE AT ALL."})
request_signature = s.generate

That's a little... generic, so let's try an example. To generate the signature the Twitter API example documented here and here, do this:

require 'autopen'
s ="post", "", {"status" => "Hello Ladies + Gentlemen, a signed OAuth request!"}, {:consumer_key => "xvz1evFS4wEEPTGEFPHBog", :consumer_secret => "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw", :version => "1.0", :timestamp => 1318622958, :nonce => "kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg", :token => "370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", :token_secret => "LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE"})
request_signature = s.generate # returns "tnnArxj06cWHq44gCs1OSKk%2FjLY%3D"

There's two other methods on an Autopen::Signature that might be useful. One is oauth_params, which will return an alphabetized Hash of all the OAuth params. The other is url, which will return the url you entered along with the OAuth params.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request