Class: Omniauth::Rails::Provider::GoogleOauth2

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth/rails/provider/google_oauth2.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ GoogleOauth2

Returns a new instance of GoogleOauth2.



8
9
10
11
# File 'lib/omniauth/rails/provider/google_oauth2.rb', line 8

def initialize(config)
  @config = config
  validate!
end

Instance Method Details

#client_idObject



13
14
15
# File 'lib/omniauth/rails/provider/google_oauth2.rb', line 13

def client_id
  config["client_id"]
end

#client_secretObject



17
18
19
# File 'lib/omniauth/rails/provider/google_oauth2.rb', line 17

def client_secret
  config["client_secret"]
end

#configureObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/omniauth/rails/provider/google_oauth2.rb', line 29

def configure
  this_provider = self
  ::Rails.application.config.middleware.use OmniAuth::Builder do
    provider(
      :google_oauth2,
      this_provider.client_id,
      this_provider.client_secret,
      this_provider.params,
    )
  end
end

#paramsObject



21
22
23
24
25
26
27
# File 'lib/omniauth/rails/provider/google_oauth2.rb', line 21

def params
  {
    access_type: "online",
    approval_prompt: "auto",
    # prompt: "none", # none, consent, select_account
  }
end