Skip to content

Commit

Permalink
Added an example authentication hash to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mloughran committed May 7, 2010
1 parent 39b8d1b commit 266e6b9
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,25 @@ Examples
Client example

params = {:some => 'parameters'}
token = Signature::Token.new(key, secret)
request = Signature::Request.new('POST', '/api/thing, params)
token = Signature::Token.new('my_key', 'my_secret')
request = Signature::Request.new('POST', '/api/thing', params)
auth_hash = request.sign(token)
query_params = params.merge(auth_hash)

HTTParty.post('http://myservice/api/thing', {
:query => params.merge(auth_hash)
:query => query_params
})

`query_params` looks like:

{
:some => "parameters",
:auth_timestamp => 1273231888,
:auth_signature => "28b6bb0f242f71064916fad6ae463fe91f5adc302222dfc02c348ae1941eaf80",
:auth_version => "1.0",
:auth_key => "my_key"
}

Server example (sinatra)

error Signature::AuthenticationError do |controller|
Expand Down

0 comments on commit 266e6b9

Please sign in to comment.