Python SignedJwtAssertionCredentials返回“AccessTokenRefreshError:未经授权的\u客户端”

Python SignedJwtAssertionCredentials返回“AccessTokenRefreshError:未经授权的\u客户端”,python,oauth-2.0,google-api,Python,Oauth 2.0,Google Api,我正在为我的雇主开发一个Python脚本,它使用Google API Python客户端。但是,我在通过SignedJwtAssertionCredentials进行OAuth身份验证时遇到了问题。有关守则如下: from apiclient.discovery import build from oauth2client.client import SignedJwtAssertionCredentials SERVICE_ACCOUNT_EMAIL = 'abunchofmumbojumb

我正在为我的雇主开发一个Python脚本,它使用Google API Python客户端。但是,我在通过SignedJwtAssertionCredentials进行OAuth身份验证时遇到了问题。有关守则如下:

from apiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials

SERVICE_ACCOUNT_EMAIL = 'abunchofmumbojumbo@developer.gserviceaccount.com'
SERVICE_ACCOUNT_PKCS12_FILE_PATH = 'key.p12'
USER_EMAIL = 'emailaccountusedtoaccessdeveloperconsole@gmail.com'

f = file(SERVICE_ACCOUNT_PKCS12_FILE_PATH, 'rb')
key = f.read()
f.close()

credentials = SignedJwtAssertionCredentials(
  SERVICE_ACCOUNT_EMAIL,
  key,
  scope='https://www.googleapis.com/auth/youtube', 
  sub=USER_EMAIL)

http = httplib2.Http()
http = credentials.authorize(http)

service = build('youtube', 'v3', http=http)
这是Python在执行代码时返回的结果:

oauth2client.client.AccessTokenRefreshError: unauthorized_client
我试着在网上搜索如何解决这个问题,但什么也找不到。我最好的猜测是,我没有将正确的变量传递给SignedJwtAssertionCredentials,但我不能完全确定情况是否如此。任何帮助都将不胜感激