SSL_REDIRECT=true
-GOOGLE_CLIENT_SECRETS='{"web": {"json": "goes here"} }'
+GOOGLE_SERVICE_EMAIL='numbers-alphanumerics@developer.gserviceaccount.com'
GOOGLE_USER='GoogleApps@Email.Address'
GOOGLE_SERVICE_KEY_BASE64='Base64EncodedP12FileContentsGoHere'
to create a Google Drive service account. If using Google Apps, it is worth
looking at [these instructions](https://developers.google.com/drive/delegation).
+Populate the `GOOGLE_USER` environment variable with the email address of the
+user whose Google Drive will be accessed. This is typically your own email
+address.
+
Google Drive used to use p12 files by default. Now a new-style JSON file is
downloaded by default when creating new credentials. Until the code has been
[updated](https://github.com/FinalsClub/karmaworld/issues/437) to use the
new-style JSON file, make sure to click the `Generate a new P12 key` button.
+While on the Credentials page (with the `Generate a new P12 key` button
+visible), note the Service account Email address. It will have a format like
+`numbers-alphanumerics@developer.gserviceaccount.com`. Copy this value and
+paste it into the `GOOGLE_SERVICE_EMAIL` environment variable.
+
Convert the p12 file into a Base64 encoded string for the
`GOOGLE_SERVICE_KEY_BASE64` environment variable. There are many ways to do
this. If Python is available, the
PDF_MIMETYPE = 'application/pdf'
PPT_MIMETYPES = ['application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation']
-GOOGLE_CLIENT_SECRETS = os.environ['GOOGLE_CLIENT_SECRETS']
+GOOGLE_SERVICE_EMAIL = os.environ['GOOGLE_SERVICE_EMAIL']
GOOGLE_SERVICE_KEY_BASE64 = os.environ['GOOGLE_SERVICE_KEY_BASE64']
GOOGLE_USER = os.environ['GOOGLE_USER']
https://developers.google.com/drive/delegation
"""
- # Extract the service address from the client secret
- service_user = json.loads(GOOGLE_CLIENT_SECRETS)['web']['client_email']
-
# Pull in the service's p12 private key.
p12 = base64.decodestring(GOOGLE_SERVICE_KEY_BASE64)
- credentials = SignedJwtAssertionCredentials(service_user, p12,
+ credentials = SignedJwtAssertionCredentials(GOOGLE_SERVICE_EMAIL, p12,
scope='https://www.googleapis.com/auth/drive',
sub=GOOGLE_USER)