Class: OauthRails::OauthController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/oauth_rails/oauth_controller.rb

Instance Method Summary collapse

Instance Method Details

#authorizeObject



11
12
13
14
15
16
17
18
19
# File 'app/controllers/oauth_rails/oauth_controller.rb', line 11

def authorize
  return OAuthRails.call(:initialize_authorization_failed, self) if request_token_hash.nil?

  if access_token
    OAuthRails.call(:authorization_successful, self, access_token.token, access_token.secret)
  else
    OAuthRails.call(:authorization_failed, self)
  end
end

#handshakeObject



2
3
4
5
6
7
8
9
# File 'app/controllers/oauth_rails/oauth_controller.rb', line 2

def handshake
  OAuthRails.call(:initialize_handshake, self)

  token                 = consumer.get_request_token(oauth_callback: OAuthRails.config.oauth_callback_url)
  session[:oauth_rails] = { token: token.token, secret: token.secret }

  redirect_to token.authorize_url
end