nxtbgthng / OAuth2Client

Client library for OAuth2 (currently built against draft 10 of the OAuth2 spec)
855 stars 217 forks source link

broken encoding with python 3.4 (fix inside) #187

Closed richiverse closed 9 years ago

richiverse commented 9 years ago

context:

.../site-packages/oauth2client/client.py", line 1515, in __init__
self.private_key = base64.b64encode(private_key) 
File ".../venv/lib/python3.4/base64.py", line 62, in b64encode
encoded = binascii.b2a_base64(s)[:-1]
TypeError: 'str' does not support the buffer interface

Changing line 1515 in oauth2client/client.py from this:

self.private_key = base64.b64encode(private_key)

to this:

self.private_key = base64.b64encode(private_key.encode('ascii'))

fixed my issue.

reference: http://stackoverflow.com/questions/27160352/when-convert-to-base-64-typeerror-str-does-not-support-the-buffer-interface

toto commented 9 years ago

I think you have the wrong OAuth2Client. This is an iOS/OS X library for OAuth 2, not python.