Sha256: d0d3eb3f2213fa798d38f14328da2f3ff64e78c68ed6ab115e5fb59d81a20648
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
# encoding: utf-8 module OmniAuth module Strategies # # Authenticate to PassaporteWeb via OAuth and retrieve an access token for API usage # # Usage: # # use OmniAuth::Strategies::PassaporteWeb, 'consumerkey', 'consumersecret', :client_options => {:site => 'http://sandbox.app.passaporteweb.com.br'} # class PassaporteWeb < OmniAuth::Strategies::OAuth # Give your strategy a name. option :name, "passaporte_web" # This is where you pass the options you would pass when # initializing your consumer from the OAuth gem. option :client_options, { :site => "http://sandbox.app.passaporteweb.com.br", :request_token_path => "/sso/initiate", :authorize_path => "/sso/authorize", :access_token_path => "/sso/token", :signature_method => "PLAINTEXT" } # These are called after authentication has succeeded. If # possible, you should try to set the UID without making # additional calls (if the user id is returned with the token # or as a URI parameter). This may not be possible with all # providers. # uid{ request.params['uuid'] } uid{ user_data['uuid'] } info do { 'uuid' => user_data['uuid'], 'nickname' => user_data['nickname'], 'email' => user_data['email'], 'first_name' => user_data['first_name'], 'last_name' => user_data['last_name'], 'name' => [user_data['first_name'], user_data['last_name']].join(' ').strip, } end extra do { 'user_hash' => user_data } end def user_data @result ||= access_token.post('/sso/fetchuserdata', nil) @user_data ||= MultiJson.decode(@result.body) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omni_auth_passaporte_web-3.0.0 | lib/omni_auth_passaporte_web/passaporte_web.rb |