I just started receiving this error on existing code that was working just fine a few days ago in python v3.11.7 code. I’m running on TG Cloud Free Version 3.9.3 using pyTigerGraph 1.5.1 library.
The code creates the Secret just fine, but when it makes a call to the getToken(), it complains that I cannot request a token with username/password for versions < 3.5 … Which doesn’t make any sense since I’m running 3.9.3
Any insights on how to resolve this would be greatly appreciated…
That’s indeed weird. Could you run “conn.version” and see what the version is? Thanks!
Here ya go…
self._conn.version ‘3.9.3’
That’s even more puzzling Sorry for the trouble. It is trickier than I thought. Do you mind sharing the code of how you create the conntion object and how you call the getToken() function?
Its pretty straightforward. Here is the code to create the connection:
self._conn = tg.TigerGraphConnection(host = self.host,
graphname = self.graphName,
username = self.userName,
password = self._passWord,
apiToken = self._token,
gsqlVersion = self.version,
tgCloud = self.tgCloud)
Here is the code to call the Secret and Token:
self._secret = self.getConnection().createSecret(alias=aliasName)
tokenTuple = self.getConnection().getToken(self._secret,lifetime=int(expirationDate))
None of the above code hasn’t changed and I have written this over 2 years ago…
I would take a look at the getToken() function in pyTigerGraphAuth.py file and see if the logic make sense to you
oh I see what is going on. There is a bug in the pyTigerGraphAuth code. But to unblock you for now, I think you can skip passing the secret to the getToken function and it will use username/password
Hey Bill,
I also noticed the getToken() function isn’t returning a tuple, but a string.
The documentation says that it returns:
A tuple of (<token>, <expiration_timestamp_unixtime>, <expiration_timestamp_ISO8601>)
I was parsing on the <expiration_timestamp_ISO8601> element.
Hey @demit733 - I just patched the logic error, and that should be in a new release of pyTG soon. Unfortunately, the database changed what was returned from the database, so unfortunately we don’t get the expiration timestamp any longer, and hence only the string being returned. Will update this thread when we release pyTG v1.5.2 so you can upgrade.
Thank you Parker for the status up… Might want to update your documentation to reflect the new reality of getToken() function
We will, unfortunately that doc is only on minor version releases. The docstring has been updated to reflect it though as well.