You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the HttpNegotiateAuth() function with requests to post a file to a kerberos SSO webserver and keept getting this error message in windows:
File "C:\Users\X.X\AppData\Roaming\Python\Python39\site-packages\requests_negotiate_sspi\requests_negotiate_sspi.py", line 149, in _retry_using_http_Negotiate_auth
tokenbuf.Buffer = base64.b64decode(final)
File "c:\Program Files\Python39\lib\base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (505) cannot be 1 more than a multiple of 4
I found that the final variable in the list:
tokenbuf.Buffer = base64.b64decode(final)
didn't contain a = character at the end, when I replaced the current like with this:
tokenbuf.Buffer = base64.b64decode(final + (b'=' if final[:-1] != '=' else b''))
After that, I didn't have any issues.
Best regards,
Zydox
The text was updated successfully, but these errors were encountered:
Hello.
I'm using the HttpNegotiateAuth() function with requests to post a file to a kerberos SSO webserver and keept getting this error message in windows:
File "C:\Users\X.X\AppData\Roaming\Python\Python39\site-packages\requests_negotiate_sspi\requests_negotiate_sspi.py", line 149, in _retry_using_http_Negotiate_auth
tokenbuf.Buffer = base64.b64decode(final)
File "c:\Program Files\Python39\lib\base64.py", line 87, in b64decode
return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (505) cannot be 1 more than a multiple of 4
I found that the final variable in the list:
tokenbuf.Buffer = base64.b64decode(final)
didn't contain a = character at the end, when I replaced the current like with this:
tokenbuf.Buffer = base64.b64decode(final + (b'=' if final[:-1] != '=' else b''))
After that, I didn't have any issues.
Best regards,
Zydox
The text was updated successfully, but these errors were encountered: