Sha256: 90671a51c59deb009be017f03b9d57098befc7063b3b5c3be3492886ccd28aa5

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

require 'omniauth/strategies/oauth2'

module OmniAuth
  module Strategies
    class Trackvia < OmniAuth::Strategies::OAuth2

      option :name, 'trackvia'

      option :client_options,
             site: 'https://go.trackvia.com',
             authorize_url: 'https://go.trackvia.com/oauth/authorize',
             token_url: 'https://go.trackvia.com/oauth/token'

      uid { user_id }

      info do
        { uid: user_id,
          name: username,
          email: user_email }
      end

      extra do
        { raw_info: raw_info }
      end

      def user_email
        raw_info['email']
      end

      def username
        raw_info['username']
      end

      def user_id
        raw_info['id']
      end

      def raw_info
        @raw_info ||= access_token.get('users').parsed
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-trackvia-0.1.1 lib/omniauth/strategies/trackvia.rb