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
- Order all the parameters of the cal in alphabetic order of its keys
- Convert them into a string representation such that, if the hash is of type 'snarf' then its string representation would be "name=snarf"
- Append the api key given to you to the string after adding a "&" so the resulting string will become "name=snarf&API-KEY-HERE"
- Use SHA1 to generate a hashkey from the resulting string
- Append the generated hashkey as a paramter of the API call
Contributing
- Fork it ( http://github.com/
/basic_api_auth/fork ) - Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request