From: Christian Weiske Date: Sat, 28 Oct 2017 13:08:10 +0000 (+0200) Subject: Support auth servers with ? in their URL X-Git-Tag: v0.5.2~2 X-Git-Url: https://git.cweiske.de/shpub.git/commitdiff_plain/f0e6be835371fdb438546501fe0b98bbee5cf538 Support auth servers with ? in their URL Resolves: https://github.com/cweiske/shpub/issues/10 --- diff --git a/src/shpub/Command/Connect.php b/src/shpub/Command/Connect.php index e920777..6ac5ed4 100644 --- a/src/shpub/Command/Connect.php +++ b/src/shpub/Command/Connect.php @@ -177,11 +177,13 @@ class Command_Connect protected function getBrowserAuthUrl($host, $user, $redirect_uri, $state, $scope) { + $sep = strpos($host->endpoints->authorization, '?') === false + ? '?' : '&'; return $host->endpoints->authorization - . '?me=' . urlencode($user) + . $sep . 'me=' . urlencode($user) . '&client_id=' . urlencode(static::$client_id) . '&redirect_uri=' . urlencode($redirect_uri) - . '&state=' . $state + . '&state=' . urlencode($state) . '&scope=' . urlencode($scope) . '&response_type=code'; }