Commit bf1f939f authored by Roland Haas's avatar Roland Haas
Browse files

make client_id a class variable

this way one could overwrite it in user code if so desired
parent b68c8c59
......@@ -27,11 +27,11 @@ class GlobusTransferHelper:
# TODO: move generic routines (for globus client) into base class
tclient = None
TIMEOUT = 60
CLIENT_ID = 'c87acef9-2bac-4743-90e8-2ae9e999ff29'
# TODO add globus magic strings as constants
def __init__(self):
# this ID uniquely identifies the script to Globus together with the
# access token it lets the script act on the user's behalf
CLIENT_ID = 'c87acef9-2bac-4743-90e8-2ae9e999ff29'
REDIRECT_URI = 'https://auth.globus.org/v2/web/auth-code'
SCOPES = 'openid email profile ' \
'urn:globus:auth:scope:transfer.api.globus.org:all'
......@@ -43,13 +43,13 @@ class GlobusTransferHelper:
tokens = self.load_tokens_from_file(TOKEN_FILE)
except:
# if we still need to get tokens, start the Native App authentication process
tokens = self.do_native_app_authentication(CLIENT_ID, REDIRECT_URI, SCOPES)
tokens = self.do_native_app_authentication(self.CLIENT_ID, REDIRECT_URI, SCOPES)
try:
self.save_tokens_to_file(TOKEN_FILE, tokens)
except:
pass
transfer_tokens = tokens['transfer.api.globus.org']
auth_client = globus_sdk.NativeAppAuthClient(client_id=CLIENT_ID)
auth_client = globus_sdk.NativeAppAuthClient(client_id=self.CLIENT_ID)
def refresh_callback(token_response):
self.update_tokens_file_on_refresh(TOKEN_FILE, token_response)
authorizer = globus_sdk.RefreshTokenAuthorizer(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment