Skip to content

Commit a11f7ee

Browse files
committed
auth: add client_json
1 parent c67c8e0 commit a11f7ee

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pydrive2/auth.py

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import webbrowser
23
import httplib2
34
import oauth2client.clientsecrets as clientsecrets
@@ -310,6 +311,12 @@ def ServiceAuth(self):
310311
scopes = scopes_to_string(self.settings["oauth_scope"])
311312
keyfile_name = self.client_config.get("client_json_file_path")
312313
keyfile_dict = self.client_config.get("client_json_dict")
314+
keyfile_json = self.client_config.get("client_json")
315+
316+
if not keyfile_dict and keyfile_json:
317+
# Compensating for missing ServiceAccountCredentials.from_json_keyfile
318+
keyfile_dict = json.loads(keyfile_json)
319+
313320
if keyfile_dict:
314321
self.credentials = (
315322
ServiceAccountCredentials.from_json_keyfile_dict(

pydrive2/settings.py

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"required": False,
8383
"struct": {},
8484
},
85+
"client_json": {"type": str, "required": False},
8586
},
8687
},
8788
"oauth_scope": {

0 commit comments

Comments
 (0)