diff --git a/nats/io/client.py b/nats/io/client.py index 7adf8a9..38411d3 100644 --- a/nats/io/client.py +++ b/nats/io/client.py @@ -289,8 +289,13 @@ def connect_command(self): } if "auth_required" in self._server_info: if self._server_info["auth_required"] == True: - options["user"] = self._current_server.uri.username - options["pass"] = self._current_server.uri.password + # In case there is no password, then consider handle + # sending a token instead. + if self._current_server.uri.password is None: + options["auth_token"] = self._current_server.uri.username + else: + options["user"] = self._current_server.uri.username + options["pass"] = self._current_server.uri.password if self.options["name"] is not None: options["name"] = self.options["name"]