From 5ae827f7c25e3fe62273199ab09597c8c22c868e Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 16 Jun 2022 09:19:04 -0700 Subject: [PATCH 1/2] fix: ensure new redirect_uri propogates to OAuth2 class --- src/Client.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Client.php b/src/Client.php index 0b44dfae3..cfb59bbb4 100644 --- a/src/Client.php +++ b/src/Client.php @@ -386,6 +386,7 @@ public function createAuthUrl($scope = null) 'login_hint' => $this->config['login_hint'], 'openid.realm' => $this->config['openid.realm'], 'prompt' => $this->config['prompt'], + 'redirect_uri' => $this->config['redirect_uri'], 'response_type' => 'code', 'scope' => $scope, 'state' => $this->config['state'], From 3671de4da29cec3f8d86a2d2e754c264ef7acd8a Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Thu, 16 Jun 2022 12:46:35 -0700 Subject: [PATCH 2/2] add a test --- tests/Google/ClientTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Google/ClientTest.php b/tests/Google/ClientTest.php index 23eebd562..5046f38bf 100644 --- a/tests/Google/ClientTest.php +++ b/tests/Google/ClientTest.php @@ -1015,4 +1015,20 @@ public function testCredentialsOptionWithCredentialsLoader() $this->assertNotNull($authHeader); $this->assertEquals('Bearer abc', $authHeader); } + + public function testSetNewRedirectUri() + { + $client = new Client(); + $redirectUri1 = 'https://foo.com/test1'; + $client->setRedirectUri($redirectUri1); + + $authUrl1 = $client->createAuthUrl(); + $this->assertStringContainsString(urlencode($redirectUri1), $authUrl1); + + $redirectUri2 = 'https://foo.com/test2'; + $client->setRedirectUri($redirectUri2); + + $authUrl2 = $client->createAuthUrl(); + $this->assertStringContainsString(urlencode($redirectUri2), $authUrl2); + } }