Sha256: 61162274fc7c04669288f7f19d70c71380566afd8fca2377b6c327f84cc3aa47
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
require 'omniauth-oauth2' module OmniAuth module Strategies # Authentication strategy for connecting with the Dotloop API. class Dotloop < OmniAuth::Strategies::OAuth2 # Give your strategy a name. option :name, 'dotloop' # This is where you pass the options you would pass when # initializing your consumer from the OAuth gem. option :client_options, :site => 'https://api-gateway.dotloop.com/public/v2/', :authorize_url => 'https://auth.dotloop.com/oauth/authorize', :token_url => 'https://auth.dotloop.com/oauth/token', :auth_scheme => :basic_auth # 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 { raw_info['id'] } # https://github.com/intridea/omniauth/wiki/Auth-Hash-Schema#schema-10-and-later info do { :name => name_from_raw_info, :email => raw_info['email'], :first_name => raw_info['firstName'], :last_name => raw_info['lastName'] } end extra do { :raw_info => raw_info } end def raw_info @raw_info ||= access_token.get('account').parsed['data'] end private def name_from_raw_info return unless raw_info['firstName'] || raw_info['lastName'] "#{raw_info['firstName']} #{raw_info['lastName']}".strip end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-dotloop-1.0.0 | lib/omniauth/strategies/dotloop.rb |