Class: NoPassword::OAuth::GoogleAuthorizationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- NoPassword::OAuth::GoogleAuthorizationsController
- Includes:
- Routable
- Defined in:
- app/controllers/nopassword/oauth/google_authorizations_controller.rb
Constant Summary collapse
- AUTHORIZATION_URL =
URI("https://accounts.google.com/o/oauth2/v2/auth")
- TOKEN_URL =
URI("https://www.googleapis.com/oauth2/v4/token")
- USER_INFO_URL =
URI("https://www.googleapis.com/oauth2/v3/userinfo")
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.scope ⇒ Object
7 |
# File 'app/controllers/nopassword/oauth/google_authorizations_controller.rb', line 7 def self.scope = "openid email profile" |
Instance Method Details
#create ⇒ Object
18 19 20 |
# File 'app/controllers/nopassword/oauth/google_authorizations_controller.rb', line 18 def create redirect_to .to_s, allow_other_host: true end |
#show ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/nopassword/oauth/google_authorizations_controller.rb', line 22 def show access_token = request_access_token.parse.fetch("access_token") user_info = request_user_info(access_token: access_token).parse if user_info.any? Rails.logger.info "Authorization #{self.class} succeeded" user_info else Rails.logger.info "Authorization #{self.class} failed" end end |