diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-10-02 11:13:46 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-10-02 11:13:46 +0300 |
commit | 2cb1d617d90b4a9311e3a35434bec958f266d22a (patch) | |
tree | cd235e875814d8032ed74f18a10eb8a6a4e3d12b /app/controllers/google_api | |
parent | 5663b4808df787b1bcbf32ba54eccbb4c7537e25 (diff) |
Use expires_in for access_token validation
Diffstat (limited to 'app/controllers/google_api')
-rw-r--r-- | app/controllers/google_api/authorizations_controller.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/google_api/authorizations_controller.rb b/app/controllers/google_api/authorizations_controller.rb index 00b0c128711..890b4ce60c8 100644 --- a/app/controllers/google_api/authorizations_controller.rb +++ b/app/controllers/google_api/authorizations_controller.rb @@ -1,9 +1,13 @@ module GoogleApi class AuthorizationsController < ApplicationController def callback - session[GoogleApi::CloudPlatform::Client.session_key_for_token] = - GoogleApi::CloudPlatform::Client.new(nil, callback_google_api_authorizations_url) - .get_token(params[:code]) + token, expires_at = GoogleApi::CloudPlatform::Client + .new(nil, callback_google_api_authorizations_url) + .get_token(params[:code]) + + session[GoogleApi::CloudPlatform::Client.session_key_for_token] = token + session[GoogleApi::CloudPlatform::Client.session_key_for_expires_at] = + expires_at.to_s if params[:state] redirect_to params[:state] |