【发布时间】:2016-04-14 05:27:21
【问题描述】:
我一直在尝试使用 google oAuth2.0 对我的 django(python 3.4、django 1.9)应用程序进行身份验证,以使用 Youtube Data API v3。
我有一个用于服务器到服务器身份验证的 JSON 密钥(类型:服务帐户)。
错误源于下面的 build() 方法:
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()
我得到的错误是:
不正确的填充异常 /usr/lib/python3/dist-packages/Crypto/PublicKey/RSA.py 在 importKey,第 660 行
这是这一行:
der = binascii.a2b_base64(b('').join(lines[1:-1]))
我是 python 和 django 的新手,所以我的调试技能还没有达到标准。
【问题讨论】:
标签: python django youtube-api google-oauth padding