Sha256: c2e475ed973bbc2ac32664a8d948235145995f86b1310a20cb306df29d719c1b

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

# frozen_string_literal: true

module OmniAuth
  module InstagramGraph
    class LongLivedToken < OAuth2::AccessToken
      TOKEN_REFRESH_PATH = '/refresh_access_token'

      def refresh!(params = {})
        options = {
          token_url: TOKEN_REFRESH_PATH,
        }
        refresh_client = OmniAuth::InstagramGraph::LongLivedClient.new(client.id, client.secret, options)

        params[:grant_type] = 'ig_refresh_token'
        params[:access_token] = token

        refresh_client.get_token(params)
      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_token.rb
omniauth-instagram-graph-1.0.1 lib/omniauth/instagram-graph/long_lived_token.rb