Skip to content

narojigautam/basic_api_auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 config/basic_api_auth_key.yml file with an authentication key as follows:

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 {name: '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

About

A basic SHA1 hashkey based authentication mechanism for RESTful APIs

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages