# OmniAuth Exvo This gem contains the official Exvo strategy for OmniAuth 1.0. There is also [exvo-auth](https://github.com/Exvo/exvo_auth) gem, which provides additional helper methods, which make both users and app authorizations at Exvo easier. ## Installation Add to your `Gemfile`: ```ruby gem 'omniauth-exvo' ``` Then `bundle install`. ## Usage `OmniAuth::Strategies::Exvo` is simply a Rack middleware. Read the OmniAuth 1.0 docs for detailed instructions: https://github.com/intridea/omniauth. Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth_exvo.rb`: ```ruby Rails.application.config.middleware.use OmniAuth::Builder do provider :exvo, ENV['AUTH_CLIENT_ID'], ENV['AUTH_CLIENT_SECRET'] end ``` You need to set both `ENV['AUTH_CLIENT_ID']` and `ENV['AUTH_CLIENT_SECRET']` somewhere (vhost configuration, heroku config, `config/environments/*` or even `config/application.rb`). If you'd like to use Exvo-Auth app in staging or development environments, you need to pass the `:client_options` hash to override the default: ```ruby Rails.application.config.middleware.use OmniAuth::Builder do provider :exvo, ENV['AUTH_CLIENT_ID'], ENV['AUTH_CLIENT_SECRET'], :client_options => { :site => Exvo::Helpers.auth_uri } end ``` Also read about the [exvo_helpers](https://github.com/Exvo/exvo_helpers) gem. ## Auth Hash Here's an example *Auth Hash* available in `request.env['omniauth.auth']` (data as of 2013-04): ```ruby request.env["omniauth.auth"].to_hash.inspect { "provider" => "exvo", "uid" => 1, "credentials" => { "token" => "a2d09701559b9f26a8284d6f94670477d882ad6d9f3d92ce9917262a6b54085fa3fb99e111340459", "expires" => false }, "info" => { "nickname" => "Pawel", "email" => "pawel@exvo.com", "name" => "Pawel" }, "extra" => { "raw_info" => { "id" => 1, "nickname" => "Pawel", "country_code" => "PL", "plan" => "basic", "language" => "en", "email" => "pawel@exvo.com", "referring_user_id" => nil } } } ``` Copyright © 2011-2013 Exvo.com Development BV, released under the MIT license