Sha256: 99773cfc6faf3ec99800243a4becd259cc2eeb276297e3ae9f9a6b24ab4faaf4

Contents?: true

Size: 829 Bytes

Versions: 2

Compression:

Stored size: 829 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Artsy < OmniAuth::Strategies::OAuth2
      def self.configure
        option :client_options,
               site: OmniAuth::Artsy.config.artsy_api_url || ENV['ARTSY_API_URL'] || ENV['gravity_url'],
               authorize_url: '/oauth2/authorize?scope=offline_access&response_type=code',
               token_url: '/oauth2/access_token?scope=offline_access&response_type=code&grant_type=authorization_code'
      end

      configure

      def request_phase
        super
      end

      uid do
        raw_info['id']
      end

      info do
        { raw_info: raw_info }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/current_user', headers: { 'X-ACCESS-TOKEN' => access_token.token }).parsed
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-artsy-0.2.3 lib/omniauth/strategies/artsy.rb
omniauth-artsy-0.2.2 lib/omniauth/strategies/artsy.rb