Skip to content

Commit

Permalink
Merge pull request #26 from zhuoqiang/patch-1
Browse files Browse the repository at this point in the history
update client to support auth_token
  • Loading branch information
wallyqs authored Jan 24, 2018
2 parents 79d7821 + 1805d93 commit b24a90f
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 b24a90f

Please sign in to comment.