Skip to content
This repository was archived by the owner on Oct 9, 2023. It is now read-only.

Commit c5335cc

Browse files
author
Ganeshwara Hananda
authored
Fix user authentication token not being sent to the server (#238)
## What is the goal of this PR? We've fixed two bugs regarding the user authentication token. ## What are the changes implemented in this PR? 1. Fix the bug where the token isn't unpacked properly when received 2. Fix the bug where username isn't sent along with the token
1 parent 56f34f4 commit c5335cc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

typedb/connection/cluster/server_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ def __call__(self, context, callback):
7676
if token is None:
7777
callback((('username', self._credential.username()), ('password', self._credential.password())), None)
7878
else:
79-
callback((('token', token)), None)
79+
callback((('username', self._credential.username()), ('token', token)), None)

typedb/connection/cluster/stub.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def __init__(self, channel: Channel, credential: TypeDBCredential):
4949
self._cluster_stub = cluster_service_proto.TypeDBClusterStub(channel)
5050
self._token = None
5151
try:
52-
self._token = self._cluster_stub.user_token(cluster_user_token_req(self._credential.username()))
52+
res = self._cluster_stub.user_token(cluster_user_token_req(self._credential.username()))
53+
self._token = res.token
5354
except RpcError as e:
5455
e2 = TypeDBClientException.of_rpc(e)
5556
if e2.error_message is not None and e2.error_message is not UNABLE_TO_CONNECT:

0 commit comments

Comments
 (0)