Class: FacebookApp::OauthController

Inherits:
FacebookAppController show all
Defined in:
app/controllers/facebook_app/oauth_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

this is the callback URL. It should handle both the case where the user authenticates us and the case when they don’t



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/facebook_app/oauth_controller.rb', line 11

def create    
  if params["error_reason"] == "user_denied"
    redirect_to facebook_app.denied_path 
  else
    access_token_info = authenticator.get_access_token_info(params[:code])
    session[:at] = access_token_info["access_token"]
    session[:oauth_expiry] = token_expiration_time 

    if didnt_grant_extended_permissions 
      track_conversion(:deny_extended_permissions)
      session[:at] = nil
      redirect_to facebook_app.identified_path
    else
      track_conversion(:accept_permissions)
      redirect_to logged_in_url 
    end
  end
end

#deniedObject



4
5
6
7
# File 'app/controllers/facebook_app/oauth_controller.rb', line 4

def denied 
  track_conversion(:deny_permissions)
  client_side_redirect(facebook_app.identified_path)
end