2016-01-09 61 views
0

我一直在尝试使用谷歌oAuth2.0来验证我的django(python 3.4,django 1.9)应用程序以使用Youtube Data API v3。与谷歌oAuth2和Youtube API填充错误不正确

我有用于服务器到服务器认证的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-包/加密/公钥/ RSA.py在importKey,线660

这是此行:

der = binascii.a2b_base64(b('').join(lines[1:-1])) 

我是python和django的新手,所以我的调试技巧还没有达到标准。

回答