pygraphistry icon indicating copy to clipboard operation
pygraphistry copied to clipboard

register method not working when using token argument instead of name and password

Open AbelMeijberg opened this issue 4 years ago • 4 comments

When running the provided code from the 'get started quickly' section on the graphistry site:

graphistry.register(api=3, protocol="https", server="hub.graphistry.com", token="...")

I get the following:

Traceback (most recent call last): File "C:\Users\bonkr\PycharmProjects\semnet\venv\lib\site-packages\graphistry\pygraphistry.py", line 131, in refresh return PyGraphistry.relogin() File "C:\Users\bonkr\PycharmProjects\semnet\venv\lib\site-packages\graphistry\pygraphistry.py", line 104, in relogin = lambda: PyGraphistry.not_implemented_thunk() File "C:\Users\bonkr\PycharmProjects\semnet\venv\lib\site-packages\graphistry\pygraphistry.py", line 102, in not_implemented_thunk raise Exception('Must call login() first') Exception: Must call login() first

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/bonkr/PycharmProjects/semnet/main.py", line 19, in token="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFiZWwiLCJpYXQiOjE2MTEyMzEwMTAsImV4cCI6MTYxMTIzNDYxMCwidXNlcl9pZCI6MjY4NSwib3JpZ19pYXQiOjE2MTEyMzEwMTB9.7RSKJhs_Yh_2KiS1_k4KC_196DX2RZajSzduWwGUijs") File "C:\Users\bonkr\PycharmProjects\semnet\venv\lib\site-packages\graphistry\pygraphistry.py", line 355, in register PyGraphistry.authenticate() File "C:\Users\bonkr\PycharmProjects\semnet\venv\lib\site-packages\graphistry\pygraphistry.py", line 89, in authenticate PyGraphistry.refresh() File "C:\Users\bonkr\PycharmProjects\semnet\venv\lib\site-packages\graphistry\pygraphistry.py", line 146, in refresh util.error('Failed to refresh token: %s' % str(e)) File "C:\Users\bonkr\PycharmProjects\semnet\venv\lib\site-packages\graphistry\util.py", line 77, in error raise ValueError(msg) ValueError: Failed to refresh token: Must call login() first

When I use password and name it works.

AbelMeijberg avatar Jan 21 '21 12:01 AbelMeijberg

Thank you for catching this!

lmeyerov avatar Feb 07 '21 22:02 lmeyerov

Hello, I'm still reproducing this error. Can I know, Whether it's resolved in the latest versions? Graphistry version = "0.28.3"

kkarthikvk avatar Oct 13 '22 05:10 kkarthikvk

Hello, I'm still reproducing this error. Can I know, Whether it's resolved in the latest versions? Graphistry version = "0.28.3"

No worries, Figured it out. Need to run the login register first graphistry.register(api=3, protocol="https", server="hub.graphistry.com", username="...", password="...") and then the graphistry.register(api=3, protocol="https", server="hub.graphistry.com", token="...")

kkarthikvk avatar Oct 13 '22 07:10 kkarthikvk

fwiw, some good news here: the next release adds revocable api keys! so can move away from user/pass

out of curiosity, why are you using the jwt token, vs just user/pass?

lmeyerov avatar Oct 13 '22 07:10 lmeyerov