Closed sid3windr closed 1 year ago
Hi Tom,
I really appreciate you using this library, and many thanks for your report.
I have just released version 1.6 which I believe fixes your problem. It was related to the JWT payload's length not being a multiple of 4, and thus lacking sufficient padding (as you laid out already).
Hope this works -- let me know if not!
Regards, Max
Thanks for the fix, this is working well. Also thanks for fixing the importlib stuff, I wasn't sure where the fault was with that!
Hang on, false alarm: listing zonefiles works (might have worked before?), but downloading still yields the same binascii error.
I think I see the issue, you're comparing the full token length % 4 in _authenticate()
but the code itself is using only the second part: payload_b64 = self._token.split('.')[1]
in _get_token_jwt_payload()
It's that one that isn't a multiple of 4 even if the full token is (which it is, there's no padding added on my system - padded_token
and token
are identical in _authenticate()
)
Thanks for this library.
When trying to auth against the CZDS service I run into a Python exception:
binascii.Error: Incorrect padding
(even if www.base64decode.org did decode my JWT base64 string just fine into JSON).I'm not a pro in Python or this way of authentication at all, but at least padding the base64 string with
==
made the code work for me.I patched https://github.com/mdiez/pyCZDS/blob/main/src/pyczds/authentication.py#L33
I can make a pull request if you prefer, but I'm not sure my hack is the right solution - let me know.