Skip to content

Commit ad7e726

Browse files
committed
auth: add client_creds_dict
This allows programmatic use without having to create a temporary file.
1 parent c60051d commit ad7e726

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pydrive2/auth.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,14 @@ def ServiceAuth(self):
303303
self.LoadServiceConfigSettings()
304304
scopes = scopes_to_string(self.settings["oauth_scope"])
305305
client_service_json = self.client_config.get("client_json_file_path")
306-
if client_service_json:
306+
creds_dict = self.client_config.get("client_creds_dict")
307+
if creds_dict:
308+
self.credentials = (
309+
ServiceAccountCredentials.from_json_keyfile_dict(
310+
keyfile_dict=creds_dict, scopes=scopes
311+
)
312+
)
313+
elif client_service_json:
307314
self.credentials = (
308315
ServiceAccountCredentials.from_json_keyfile_name(
309316
filename=client_service_json, scopes=scopes

0 commit comments

Comments
 (0)