omniauth-snoonet
OmniAuth strategy to authenticate with Snoonet IRC services using OAuth 2.
Installation
Add to your Gemfile
:
gem 'omniauth-snoonet'
Then bundle install
.
Usage
OmniAuth::Strategies::Snoonet
is simply Rack middleware. Read the OmniAuth docs for instructions: https://github.com/intridea/omniauth.
An example what your config/initializers/omniauth.rb
might look like:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :snoonet, ENV['SNOONET_CLIENT_ID'], ENV['SNOONET_CLIENT_SECRET']
end
Configuration
Currently, there is only one configuration option that needs to be set:
scope
: A comma-separated list of permissions you want to request from the user. The available permissions are as follows:info
,edit
. Default:info
Rails.application.config.middleware.use OmniAuth::Builder do
provider :snoonet, ENV['SNOONET_CLIENT_ID'], ENV['SNOONET_CLIENT_SECRET'], :scope => 'info,edit'
end
Scope Details
info
: All NickServ info including the users email.edit
: The ability to make changes to the users account.
Auth Hash
Here's an example Auth Hash available in request.env['omniauth.auth']
:
{
:provider => "snoonet",
:uid => "AwesomeUser",
:info => {
:name => "AwesomeUser",
:registered => "2014-01-23 01:06:47",
:vhost => "user/AwesomeUser",
:lastquit => "I am now disconnected!",
:options => [
"Option 1",
"Option 2"
],
:email => "[email protected]"
},
:credentials => {
:token => "PtrCChoaiVXXKcofhgCP8Sf7vO9OxlyblPJdhQka",
:expires_at => 1437073311,
:expires => true
},
:extra => {
:raw_info => {
:name => "AwesomeUser",
:registered => {
:date => "2014-01-23 01:06:47",
:timezone_type => 2,
:timezone => "PST"
},
:vhost => "user/AwesomeUser",
:lastQuit => "I am now disconnected!",
:options => [
"Option 1",
"Option 2"
],
:email => "[email protected]"
}
}
}
Supported Ruby Versions
omniauth-snoonet
is tested under 1.9.2, 1.9.3, 2.0.0, 2.1.0, MRI Ruby HEAD, JRuby (1.9 mode and HEAD), and Rubinius
(2.0 mode). If the build is passing it will work under any of those Ruby versions.
Copyright and license
Copyright 2015 by Snoonet. Licensed under the MIT license.