public function getAuthorizeUrl(string $response_type, int $client_id, string $redirect_uri, string $display,
                                    ?array $scope = null, ?string $state = null, ?array $group_ids = null, bool $revoke = false): string {
        $scope_mask = 0;
        foreach ($scope as $scope_setting) {
            $scope_mask |= $scope_setting;
        }

        $params = array(
            static::PARAM_CLIENT_ID     => $client_id,
            static::PARAM_REDIRECT_URI  => $redirect_uri,
            static::PARAM_DISPLAY       => $display,
            static::PARAM_SCOPE         => $scope_mask,
            static::PARAM_STATE         => $state,
            static::PARAM_RESPONSE_TYPE => $response_type,
            static::PARAM_VERSION       => $this->version,
        );

        if ($group_ids) {
            $params[static::PARAM_GROUP_IDS] = implode(',', $group_ids);
        }

        if ($revoke) {
            $params[static::PARAM_REVOKE] = 1;
        }

        return $this->host . static::ENDPOINT_AUTHORIZE . '?' . http_build_query($params);
    }