Class: UzuUzu::Controller::Login::Google

Inherits:
Object
  • Object
show all
Defined in:
lib/uzuuzu-core/controller/login/google.rb

Instance Method Summary collapse

Instance Method Details

#callbackObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/uzuuzu-core/controller/login/google.rb', line 30

def callback
  get_config
  
  access_token = @google_client.auth_code.get_token(
    request.params[:code],
    @auth_param
  )
  session[:google_access_token] = access_token.token
  logger.debug access_token
  
  #session[:login_user_id] = access_token.params[:user_id]
  #session[:login_name] = access_token.params[:screen_name]
  #session[:login_domain] = 'google'
  referrer = session[:referer] || '/'
  #session.delete(:referer)
  response.redirect referrer || '/'
rescue => e
  logger.debug "google_callback_error #{e}"
  response.server_error
end

#indexObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/uzuuzu-core/controller/login/google.rb', line 15

def index
  get_config
  session[:referer] = session[:referer] || request.referrer || '/'

  response.redirect @google_client.auth_code.authorize_url(
    @auth_param
  )
rescue => e
  logger.debug "google_request_error #{e}"
  response.server_error
end