gitlab-org--gitlab-foss/app/controllers/google_api/authorizations_controller.rb
2017-09-25 16:10:25 +09:00

27 lines
919 B
Ruby

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)
def callback
session[access_token_key] = api_client.get_token(params[:code])
if params[:state]
redirect_to params[:state]
else
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