MAPG-181 ability to add login_hint to dialog url

This commit is contained in:
Bence Pőcze 2020-06-28 03:15:20 +02:00
parent 48eba75cf4
commit f3225ae275
Signed by: bence
GPG Key ID: AA52B11A3269D1C1

View File

@ -15,7 +15,7 @@ class GoogleOAuth
$this->request = $request;
}
public function getDialogUrl(string $state, string $redirectUrl): string
public function getDialogUrl(string $state, string $redirectUrl, ?string $loginHint = null): string
{
$oauthParams = [
'response_type' => 'code',
@ -26,6 +26,10 @@ class GoogleOAuth
'nonce' => hash('sha256', random_bytes(10) . microtime()),
];
if ($loginHint !== null) {
$oauthParams['login_hint'] = $loginHint;
}
return self::$dialogUrlBase . '?' . http_build_query($oauthParams);
}