Sha256: edacb92ef438de900ae857d270ff9d55c4943bf5e3097ee798729b6e7e95564f

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Procore < OmniAuth::Strategies::OAuth2
      option :name, 'procore'

      option :client_options,
        site: 'https://login.procore.com',
        api_site: 'https://api.procore.com',
        authorize_path: '/oauth/authorize'

      uid do
        raw_info['id']
      end

      info do
        {
          email: raw_info['login'],
          name: raw_info['name'],
          procore_id: raw_info['id']
        }
      end

      def raw_info
        access_token.client.site = options[:client_options][:api_site]
        @raw_info ||= access_token.get('/vapid/me').parsed
      end

      def callback_url
        full_host + script_name + callback_path
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-procore-0.6.0 lib/omniauth/strategies/procore.rb
omniauth-procore-0.5.1 lib/omniauth/strategies/procore.rb