Skip to content

Commit

Permalink
update client to support auth_token
Browse files Browse the repository at this point in the history
support `auth_token` to fix #25
  • Loading branch information
zhuoqiang authored Nov 28, 2017
1 parent d0db75c commit 1805d93
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nats/io/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down

0 comments on commit 1805d93

Please sign in to comment.