Skip to content

Commit adcaab6

Browse files
author
Michael Lundbøl
committed
1 parent 0929cd9 commit adcaab6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Client.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,10 @@ public function getAccessToken(): ?AccessToken
294294
*
295295
* @param string $redirectUrl
296296
* @param string|null $state
297+
* @param bool $reauthorize
297298
* @return string
298299
*/
299-
public function getLoginUrl(string $redirectUrl, ?string $state = null): string
300+
public function getLoginUrl(string $redirectUrl, ?string $state = null, bool $reauthorize = false): string
300301
{
301302
$params = [
302303
'client_id' => $this->clientConfig->getClientId(),
@@ -305,12 +306,16 @@ public function getLoginUrl(string $redirectUrl, ?string $state = null): string
305306
'grant_type' => 'authorization_code'
306307
];
307308

308-
if (null !== $state) {
309+
if (null !== $state || '' !== $state) {
309310
$params['state'] = $state;
310311
}
311312

313+
if (true === $reauthorize) {
314+
$params['prompt'] = urlencode('login consent');
315+
}
316+
312317
return rtrim($this->clientConfig->getLoginUrl(), '/') . '/services/oauth2/authorize?' .
313-
http_build_query($params, '', '&', PHP_QUERY_RFC1738);
318+
http_build_query($params, '', '&', PHP_QUERY_RFC3986);
314319
}
315320

316321
/**

0 commit comments

Comments
 (0)