A basic Rails wrapper around the Signet gem that handles persistence of a user's credentials on top of handling the auth flow within Rails applications. Check out an example Rails app that utilises this gem.
Please note this is very much work in progress... issues/suggestions/etc gratefully received. Raise an issue/create a pull-request.
Add this line to your application's Gemfile:
gem 'signet-rails'
And then execute:
$ bundle
Or install it yourself as:
$ gem install signet-rails
Check out an example Rails app that utilises this gem.
A list of items still todo or work in progress
- Give an example usage
- Example of setting default options
- Example of setting per provider options
- Clearly document default
extract\_from\_env
- Clearly document default
extract\_by\_oauth\_id
- Is there a better (Rails) way to creating per-request instances of signet OAuth clients?
- Currently use the env variable to store the handlers and references to the instances... is this thread safe (probably) and the best way (probably not)?
- Better way of sourcing the Google default authorization_uri and token_credential_uri? From signet directly?
- Clear definition of the Signet options and the
signet-rails
options - More Rails-esque way of getting the
rack.session
inextract\_from\_env
? - Better way of loading persistence wrappers in builder?
- Check to see whether we have all required signet options at the end of Builder.provder?
- Sort out
approval\_prompt
vs 'prompt' - Better
auth\_options
split at the end of Builder.provider? - Avoid having to dup options the whole time: fix signet?
- Refactor Handler.handle code... messy
- Document handling of callback in Rails
- Error handling...
- Document the various
env
values that can/will be set and when (e.g.signet.XXX.persistence\_obj
onauth\_callback
) - Allow shortened form of common scopes (userprofile etc)
- Provider
application_name
andapplicatio_version
when initialising the client (per signet error)
Credit where it is due, much of what you see here is derived from lessons learned using omniauth* but also this great post by Greg Baugues
- Fork it
- 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