Fix doRequestOAuth to find proper client secrets JSON file (#313)

The environment variables GAMUSERCONFIGDIR and CLIENTSECRETS are
factored in to GC_Values[GC_CLIENT_SECRETS_JSON]. On a new
installation, it will have the value
os.path.join(GM_Globals[GM_GAM_PATH], FN_CLIENT_SECRETS_JSON) but on an
existing installation the environment variables may have it located
somewhere else.
This commit is contained in:
Ross Scroggs
2016-11-03 10:50:43 -07:00
committed by Jay Lee
parent aa1db89bd3
commit d9124f3ffa

View File

@ -9962,7 +9962,6 @@ def doRequestOAuth(login_hint=None):
scopes.insert(0, u'email') # Email Display Scope, always included scopes.insert(0, u'email') # Email Display Scope, always included
return (True, u'') return (True, u'')
cs_file = os.path.join(GM_Globals[GM_GAM_PATH], FN_CLIENT_SECRETS_JSON)
MISSING_CLIENT_SECRETS_MESSAGE = u"""Please configure OAuth 2.0 MISSING_CLIENT_SECRETS_MESSAGE = u"""Please configure OAuth 2.0
To make GAM run you will need to populate the {0} file found at: To make GAM run you will need to populate the {0} file found at:
@ -9976,7 +9975,7 @@ See this site for instructions:
""".format(FN_CLIENT_SECRETS_JSON, GC_Values[GC_CLIENT_SECRETS_JSON], GAM_WIKI_CREATE_CLIENT_SECRETS) """.format(FN_CLIENT_SECRETS_JSON, GC_Values[GC_CLIENT_SECRETS_JSON], GAM_WIKI_CREATE_CLIENT_SECRETS)
cs_data = readFile(cs_file, mode=u'rb', continueOnError=True, displayError=True, encoding=None) cs_data = readFile(GC_Values[GC_CLIENT_SECRETS_JSON], mode=u'rb', continueOnError=True, displayError=True, encoding=None)
if not cs_data: if not cs_data:
systemErrorExit(14, MISSING_CLIENT_SECRETS_MESSAGE) systemErrorExit(14, MISSING_CLIENT_SECRETS_MESSAGE)
try: try: