Sha256: 47d24c483528692daf188a3b2963c55bc35562d8d1a836cc52b937f2443739c2

Contents?: true

Size: 756 Bytes

Versions: 1

Compression:

Stored size: 756 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Artsy < OmniAuth::Strategies::OAuth2
      option :client_options,
             site: ENV['ARTSY_API_URL'] || ENV['gravity_url'] || 'http://localhost:3000',
             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'

      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

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-artsy-0.2.0 lib/omniauth/strategies/artsy.rb