Omniauth::Thecity
This gem contains The City strategy for OmniAuth.
Before You Begin
You should have already installed OmniAuth into your app; if not, read the OmniAuth README to get started.
Installation
Add this line to your application's Gemfile:
gem 'omniauth-thecity'
Or install it yourself as:
$ gem install omniauth-thecity
Usage
Tell OmniAuth about this provider. For a Rails app, your config/initializers/omniauth.rb
file should look like this:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :thecity, "APPID", "SECRET", :scope => 'user_basic user_extended'
end
Authentication Hash
An example auth hash available in request.env['omniauth.auth']
:
{
"provider"=>:thecity,
"uid"=>216612,
"info"=> {
"global_user"=> {
"id"=>216612,
"first"=>"Robert",
"last"=>"Robertson",
"email"=>"[email protected]",
"gender"=>"Male",
"birthdate"=>"1977-10-13"
},
"user"=> {
"id"=>14347,
"title"=>"Deacon",
"member"=>false,
"staff"=>true,
"first"=>"Bob",
"last"=>"Robertson",
"email"=>"[email protected]",
"account_id"=>12345678,
"profile_picture"=> "https://....a4bfe58666_thumb.png",
"admin_privileges"=>[
{ "title"=>"Account Admin" },
{ "group_id"=>12345, "title"=>"Group Admin" },
{ "title"=>"User Admin" }
]
}
},
"credentials"=> {
"token"=>"3551fe753551355144dc88b45173551f9e69dde79f355180db35516c11b357e9",
"expires"=>false
},
"extra"=>{}
}
Watch the RailsCast
Ryan Bates has put together an excellent RailsCast on OmniAuth:
Contributing
- 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
License
Copyright (c) 2013 Mark Blair See LICENSE for details.