Class: Ishapi::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/ishapi/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#long_term_tokenObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/ishapi/application_controller.rb', line 17

def long_term_token
  authorize! :long_term_token, ::Ishapi

  accessToken   = request.headers[:accessToken]
  accessToken ||= params[:accessToken]

  params['domain'] = 'tgm.piousbox.com'

  response = HTTParty.get "https://graph.facebook.com/v5.0/oauth/access_token?grant_type=fb_exchange_token&" +
    "client_id=#{FB[params['domain']][:app]}&client_secret=#{FB[params['domain']][:secret]}&" +
    "fb_exchange_token=#{accessToken}"
  j = JSON.parse response.body
  @long_term_token = j['access_token']

  render json: { long_term_token: @long_term_token }
end

#testObject



14
15
# File 'app/controllers/ishapi/application_controller.rb', line 14

def test
end