diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-09-25 20:11:26 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-09-25 20:11:26 +0300 |
commit | bdc618c289b8c2b996a3ef92b7748966c311d28a (patch) | |
tree | 62fbc8778f67c14c907b50504c051433bd4536f8 /app/controllers/google_api | |
parent | cf8140a752afe9a00197b11c9f9d38098717e6df (diff) |
ok
Diffstat (limited to 'app/controllers/google_api')
-rw-r--r-- | app/controllers/google_api/authorizations_controller.rb | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/app/controllers/google_api/authorizations_controller.rb b/app/controllers/google_api/authorizations_controller.rb index e99c38025b8..1fafd7e88be 100644 --- a/app/controllers/google_api/authorizations_controller.rb +++ b/app/controllers/google_api/authorizations_controller.rb @@ -1,11 +1,11 @@ module GoogleApi class AuthorizationsController < ApplicationController - # callback_google_api_authorizations GET|POST /google_api/authorizations/callback(.:format) google_api/authorizations#callback - ## - # TODO: - # - Is it ok to use both "http://localhost:3000/google_api/authorizations/callback"(For login) and "http://localhost:3000/google_api/authorizations/callback"(For API token) + # /google_api/authorizations/callback(.:format) def callback - session[access_token_key] = api_client.get_token(params[:code]) + # TODO: Error handling + session[GoogleApi::CloudPlatform::Client.token_in_session] = + GoogleApi::Authentication.new(nil, callback_google_api_authorizations_url) + .get_token(params[:code]) if params[:state] redirect_to params[:state] @@ -13,15 +13,5 @@ module GoogleApi redirect_to root_url end end - - def api_client - @api_client ||= - GoogleApi::Authentication.new(nil, callback_google_api_authorizations_url) - end - - def access_token_key - # :"#{api_client.scope}_access_token" - :"hoge_access_token" # TODO: - end end end |