From f2b5b8ac98cf08a00c747d42aa937b819b5bcfbd Mon Sep 17 00:00:00 2001 From: Heng Xiong Date: Mon, 17 Jul 2017 11:14:06 -0700 Subject: [PATCH] Upgrade to new token URI --- lib/googleauth/service_account.rb | 4 ++-- lib/googleauth/user_refresh.rb | 2 +- spec/googleauth/service_account_spec.rb | 2 +- spec/googleauth/user_authorizer_spec.rb | 4 ++-- spec/googleauth/user_refresh_spec.rb | 2 +- spec/googleauth/web_user_authorizer_spec.rb | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/googleauth/service_account.rb b/lib/googleauth/service_account.rb index f66abe3..03bc0cf 100644 --- a/lib/googleauth/service_account.rb +++ b/lib/googleauth/service_account.rb @@ -46,7 +46,7 @@ module Google # # cf [Application Default Credentials](http://goo.gl/mkAHpZ) class ServiceAccountCredentials < Signet::OAuth2::Client - TOKEN_CRED_URI = 'https://www.googleapis.com/oauth2/v3/token'.freeze + TOKEN_CRED_URI = 'https://www.googleapis.com/oauth2/v4/token'.freeze extend CredentialsLoader # Creates a ServiceAccountCredentials. @@ -119,7 +119,7 @@ module Google class ServiceAccountJwtHeaderCredentials JWT_AUD_URI_KEY = :jwt_aud_uri AUTH_METADATA_KEY = Signet::OAuth2::AUTH_METADATA_KEY - TOKEN_CRED_URI = 'https://www.googleapis.com/oauth2/v3/token'.freeze + TOKEN_CRED_URI = 'https://www.googleapis.com/oauth2/v4/token'.freeze SIGNING_ALGORITHM = 'RS256'.freeze EXPIRY = 60 extend CredentialsLoader diff --git a/lib/googleauth/user_refresh.rb b/lib/googleauth/user_refresh.rb index 14c1990..a54a4c9 100644 --- a/lib/googleauth/user_refresh.rb +++ b/lib/googleauth/user_refresh.rb @@ -46,7 +46,7 @@ module Google # # cf [Application Default Credentials](http://goo.gl/mkAHpZ) class UserRefreshCredentials < Signet::OAuth2::Client - TOKEN_CRED_URI = 'https://www.googleapis.com/oauth2/v3/token'.freeze + TOKEN_CRED_URI = 'https://www.googleapis.com/oauth2/v4/token'.freeze AUTHORIZATION_URI = 'https://accounts.google.com/o/oauth2/auth'.freeze REVOKE_TOKEN_URI = 'https://accounts.google.com/o/oauth2/revoke'.freeze extend CredentialsLoader diff --git a/spec/googleauth/service_account_spec.rb b/spec/googleauth/service_account_spec.rb index 8c569a1..679c0ef 100644 --- a/spec/googleauth/service_account_spec.rb +++ b/spec/googleauth/service_account_spec.rb @@ -137,7 +137,7 @@ describe Google::Auth::ServiceAccountCredentials do _claim, _header = JWT.decode(params.assoc('assertion').last, @key.public_key) end - stub_request(:post, 'https://www.googleapis.com/oauth2/v3/token') + stub_request(:post, 'https://www.googleapis.com/oauth2/v4/token') .with(body: hash_including( 'grant_type' => 'urn:ietf:params:oauth:grant-type:jwt-bearer' ), diff --git a/spec/googleauth/user_authorizer_spec.rb b/spec/googleauth/user_authorizer_spec.rb index 5e8d62e..258dc30 100644 --- a/spec/googleauth/user_authorizer_spec.rb +++ b/spec/googleauth/user_authorizer_spec.rb @@ -242,7 +242,7 @@ describe Google::Auth::UserAuthorizer do end before(:example) do - stub_request(:post, 'https://www.googleapis.com/oauth2/v3/token') + stub_request(:post, 'https://www.googleapis.com/oauth2/v4/token') .to_return(body: token_json, status: 200, headers: { 'Content-Type' => 'application/json' }) @@ -270,7 +270,7 @@ describe Google::Auth::UserAuthorizer do context 'with invalid authorization code' do before(:example) do - stub_request(:post, 'https://www.googleapis.com/oauth2/v3/token') + stub_request(:post, 'https://www.googleapis.com/oauth2/v4/token') .to_return(status: 400) end diff --git a/spec/googleauth/user_refresh_spec.rb b/spec/googleauth/user_refresh_spec.rb index d80f6ba..e68d3ce 100644 --- a/spec/googleauth/user_refresh_spec.rb +++ b/spec/googleauth/user_refresh_spec.rb @@ -68,7 +68,7 @@ describe Google::Auth::UserRefreshCredentials do body = MultiJson.dump('access_token' => access_token, 'token_type' => 'Bearer', 'expires_in' => 3600) - stub_request(:post, 'https://www.googleapis.com/oauth2/v3/token') + stub_request(:post, 'https://www.googleapis.com/oauth2/v4/token') .with(body: hash_including('grant_type' => 'refresh_token')) .to_return(body: body, status: 200, diff --git a/spec/googleauth/web_user_authorizer_spec.rb b/spec/googleauth/web_user_authorizer_spec.rb index 04e30dd..4dd764b 100644 --- a/spec/googleauth/web_user_authorizer_spec.rb +++ b/spec/googleauth/web_user_authorizer_spec.rb @@ -107,7 +107,7 @@ describe Google::Auth::WebUserAuthorizer do end before(:example) do - stub_request(:post, 'https://www.googleapis.com/oauth2/v3/token') + stub_request(:post, 'https://www.googleapis.com/oauth2/v4/token') .to_return(body: token_json, status: 200, headers: { 'Content-Type' => 'application/json' })