Simple authentication using Github credentials.
The installation is really simple, just throw this in your
Or — if you’re using Rails 2.x — put this in
Guestlist in your user model (mine is called
class User # It works with ActiveRecord too. ;) include MongoMapper::Document include key :login, String key :encrypted_token, String end
Believe it or not, you’re all set. Let’s try it (you can find your token on the Github account page):
User.authenticate 'github_login', 'github_token'
Guestlist will automatically create a new
User for you and return that, or false if you’ve entered a wrong login or token. The user’s token is stored — yes, encrypted — , so next time you log in, it’ll just authenticate you via the database.
Copyright © 2009 Jeff Kreeftmeijer, released under the MIT license