A basic SHA1 hashkey based authentication implementation.
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
Create a config/basic_api_auth_key.yml file with an authentication key as follows:
api_key: 'API-KEY-HERE'
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 {name: '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
- 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