public function setAuth($type, $value)
    {
        switch ($type) {
            case self::AUTH_BASIC:
                // The use of base64 encoding for authorization headers follow the RFC 2617 standard for http
                // authentication (https://www.ietf.org/rfc/rfc2617.txt).
                $this->addHeader(
                    self::HEADER_AUTHORIZATION,
                    'Basic ' . base64_encode(implode(':', $value))
                );
                break;

            case self::AUTH_BEARER:
                $this->addHeader(self::HEADER_AUTHORIZATION, 'Bearer ' . $value);
                break;

            default:
                throw new NostoException('Unsupported auth type.');
        }
    }