Sha256: 84a56eabbb5399feed562eae90cb2464fa2089f9257726a8693979ab657b7fbd

Contents?: true

Size: 945 Bytes

Versions: 1

Compression:

Stored size: 945 Bytes

Contents

require 'omniauth-oauth2'

# require 'omniauth/strategies/steem_connect'
# sc = OmniAuth::Strategies::SteemConnect.new 'crowdini.app', '63e99efeff2d5dbae37b220d1774a7733bd5e25ad9881b92'

module OmniAuth
  module Strategies
    class Steemconnect < OmniAuth::Strategies::OAuth2
      option :client_options,
             site: 'https://v2.steemconnect.com/api',
             authorize_url: 'https://v2.steemconnect.com/oauth2/authorize',
             token_url: 'https://v2.steemconnect.com/api/oauth2/token'

      uid { raw_info['user'] }

      info do
        {
            username: raw_info['user']
        }
      end

      extra do
        {
            raw_info: raw_info
        }
      end

      def raw_info
        @raw_info ||= access_token.get('/api/me').parsed || {}
      end

      def request_phase
        options[:authorize_params] = {
            scope: options['scope']
        }
        super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-steemconnect-0.1.0 lib/omniauth/strategies/steemconnect.rb