Sha256: 111a8610c36f05d880a0aca6dbd643d7ad27b6727623a7c238f327198fdb4ad8

Contents?: true

Size: 856 Bytes

Versions: 5

Compression:

Stored size: 856 Bytes

Contents

module FbGraph2
  class Auth < Rack::OAuth2::Client
    class Grant
      class FbExchangeToken < Rack::OAuth2::Client::Grant
        attr_required :fb_exchange_token
      end
    end

    def initialize(client_id, client_secret, options = {})
      super options.merge(
        identifier: client_id,
        secret: client_secret,
        host: URI.parse(FbGraph2.root_url).host,
        authorization_endpoint: '/oauth/authorize',
        token_endpoint: '/oauth/access_token'
      )
    end

    def fb_exchange_token=(access_token)
      @grant = Grant::FbExchangeToken.new(
        fb_exchange_token: access_token
      )
    end

    def access_token!(options = {})
      super options.merge(
        client_auth_method: :body
      )
    rescue Rack::OAuth2::Client::Error => e
      raise Exception.detect(e.status, e.response)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fb_graph2-0.3.2 lib/fb_graph2/auth.rb
fb_graph2-0.3.1 lib/fb_graph2/auth.rb
fb_graph2-0.3.0 lib/fb_graph2/auth.rb
fb_graph2-0.2.0 lib/fb_graph2/auth.rb
fb_graph2-0.1.3 lib/fb_graph2/auth.rb