README.md in omniauth-exvo-0.0.3 vs README.md in omniauth-exvo-0.0.4

- old
+ new

@@ -14,27 +14,69 @@ ``` Then `bundle install`. -## Basic usage +## Usage -Set both `ENV['AUTH_CLIENT_ID']` and `ENV['AUTH_CLIENT_SECRET']` somewhere (vhost configuration, heroku config, `config/environments/*` or even `config/application.rb`). +`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 -use OmniAuth::Builder do +Rails.application.config.middleware.use OmniAuth::Builder do provider :exvo, ENV['AUTH_CLIENT_ID'], ENV['AUTH_CLIENT_SECRET'] end ``` -If you'd like to use Exvo's staging auth, you need to pass the `:client_options` hash to override the default: +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 -use OmniAuth::Builder do - provider :exvo, ENV['AUTH_CLIENT_ID'], ENV['AUTH_CLIENT_SECRET'], :client_options => { :site => 'http://staging.auth.exvo.com' } +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 -Copyright © 2011-2012 Exvo.com Development BV, released under the MIT license +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