Python Google oAuth2和Youtube API的填充错误不正确
我一直在尝试用google oAuth2.0验证我的django(python 3.4,django 1.9)应用程序,以使用Youtube数据API v3 我有一个用于服务器到服务器身份验证的JSON密钥(类型:服务帐户) 错误源于下面的build()方法:Python Google oAuth2和Youtube API的填充错误不正确,python,django,youtube-api,google-oauth,padding,Python,Django,Youtube Api,Google Oauth,Padding,我一直在尝试用google oAuth2.0验证我的django(python 3.4,django 1.9)应用程序,以使用Youtube数据API v3 我有一个用于服务器到服务器身份验证的JSON密钥(类型:服务帐户) 错误源于下面的build()方法: client_email = '***@***.iam.gserviceaccount.com' with open('key.json', 'r+b', 0) as f: private_key = f.read() cred
client_email = '***@***.iam.gserviceaccount.com'
with open('key.json', 'r+b', 0) as f:
private_key = f.read()
credentials = SignedJwtAssertionCredentials(client_email, private_key,'https://www.googleapis.com/auth/youtube')
http_auth = credentials.authorize(Http())
service = build(str('youtube', 'v3', http=http_auth)
response = service.channels().list(part="id").execute()
我得到的错误是:
不正确的填充异常在
/importKey中的usr/lib/python3/dist packages/Crypto/PublicKey/RSA.py,第660行
这是哪一行:
der = binascii.a2b_base64(b('').join(lines[1:-1]))
我是Python和Django的新手,所以我的调试技巧还没有达到标准。
< P>我没有找到这个问题的答案,但是我发现你不能用YouTube的数据API V3使用服务帐户,这就成了一个很小的问题。 资料来源: