Sha256: 0eb4402fcfd7bf9c21a4c971e2fcac184e0bef5587dd92b96541e435fbf46d15

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

module OmniAuth
  module InstagramGraph
    class LongLivedClient < OAuth2::Client
      TOKEN_URL = '/access_token'

      def initialize(client_id, client_secret, options = {})
        options = {
          site: 'https://graph.instagram.com',
          authorize_url: nil,
          token_url: TOKEN_URL,
          token_method: :get,
        }.merge!(options)

        super(client_id, client_secret, options)
      end

      def get_token(params = {})
        params = {grant_type: 'ig_exchange_token', client_secret: secret}.merge!(params)
        super(params, {}, LongLivedToken)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-instagram-graph-1.0.2 lib/omniauth/instagram-graph/long_lived_client.rb
omniauth-instagram-graph-1.0.1 lib/omniauth/instagram-graph/long_lived_client.rb