Sha256: 705b2c7496086e234eb1da7f941c58379d62df59924e32447ba776ed0f84748a

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

require 'omniauth-oauth2'
require 'coinbase'

module OmniAuth
  module Strategies
    class Coinbase < OmniAuth::Strategies::OAuth2
      option :name, 'coinbase'
      option :client_options, {
              :site => 'https://coinbase.com',
              :authorize_url => 'https://www.coinbase.com/oauth/authorize',
              :token_url => 'https://www.coinbase.com/oauth/token',
              :proxy => ENV['http_proxy'] ? URI(ENV['http_proxy']) : nil,
              :ssl => {
                :verify => true,
                :cert_store => ::Coinbase::Client.whitelisted_cert_store
              }
      }
      option :authorize_options, [:scope, :meta]


      uid { raw_info['id'] }

      info do
        {
          :id => raw_info['id'],
          :name => raw_info['name'],
          :email => raw_info['email']
        }
      end

      extra do
        { :raw_info => raw_info }
      end

      def raw_info
        @raw_info ||= MultiJson.load(access_token.get('/api/v1/users').body)['users'][0]['user']
      rescue ::Errno::ETIMEDOUT
        raise ::Timeout::Error
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-coinbase-1.0.5 lib/omniauth/strategies/coinbase.rb
omniauth-coinbase-1.0.4 lib/omniauth/strategies/coinbase.rb