Class: OmniAuth::InstagramGraph::LongLivedToken

Inherits:
OAuth2::AccessToken
  • Object
show all
Defined in:
lib/omniauth/instagram-graph/long_lived_token.rb

Constant Summary collapse

TOKEN_REFRESH_PATH =
'/refresh_access_token'

Instance Method Summary collapse

Instance Method Details

#refresh!(params = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/omniauth/instagram-graph/long_lived_token.rb', line 8

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