BasicApiAuth

A basic SHA1 hashkey based authentication implementation.

Installation

Add this line to your application's Gemfile:

gem 'basic_api_auth'

And then execute:

$ bundle

Or install it yourself as:

$ gem install basic_api_auth

Usage

create a yml file with an authentication key as follows: in config/basic_api_auth_key.yml api_key: 'API-KEY-HERE'

Generation of Hashkey

The hashkey sent to the api call should be generated by following these steps

  1. Order all the parameters of the cal in alphabetic order of its keys
  2. Convert them into a string representation such that, if the hash is of type 'snarf' then its string representation would be "name=snarf"
  3. Append the api key given to you to the string after adding a "&" so the resulting string will become "name=snarf&API-KEY-HERE"
  4. Use SHA1 to generate a hashkey from the resulting string
  5. Append the generated hashkey as a paramter of the API call

Contributing

  1. Fork it ( http://github.com//basic_api_auth/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request