Class: Freelancer::Rails::AuthorizationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Controllers::Helpers
Defined in:
app/controllers/freelancer/rails/authorizations_controller.rb

Instance Method Summary collapse

Methods included from Controllers::Helpers

#freelancer_access_secret, #freelancer_access_secret?, #freelancer_access_token, #freelancer_access_token?, #freelancer_client

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/freelancer/rails/authorizations_controller.rb', line 8

def create
  
  freelancer_client.set_callback_url(freelancer_oauth_callback_url + "?")
  session["freelancer_oauth_request_token"] = freelancer_client.request_token.token
  session["freelancer_oauth_request_secret"] = freelancer_client.request_token.secret

  authorize_url = freelancer_client.request_token.authorize_url
  redirect_to authorize_url

end

#newObject



5
6
# File 'app/controllers/freelancer/rails/authorizations_controller.rb', line 5

def new
end

#oauth_callbackObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/freelancer/rails/authorizations_controller.rb', line 19

def oauth_callback

  request_token = session["freelancer_oauth_request_token"]
  request_secret = session["freelancer_oauth_request_secret"]

  freelancer_client.authorize_from_request(request_token, request_secret, params[:oauth_verifier])
  session["freelancer_oauth_access_token"] = freelancer_client.access_token.token
  session["freelancer_oauth_access_secret"] = freelancer_client.access_token.secret

  redirect_to root_path
  
end