Skip to content

Commit

Permalink
Add try/except to get auth url
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Sep 13, 2024
1 parent 9d4f346 commit 4a1c359
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions service/controllers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,19 @@ def get(self, client_id, endpoint_id):
SCOPE = f"urn:globus:auth:scope:transfer.api.globus.org:all[*{DEPENDENT_SCOPE}]"
else:
logger.debug(f'endpoint is a gcp')

session_client = client.oauth2_start_flow(refresh_tokens=True, requested_scopes=SCOPE)

authorize_url = client.oauth2_get_authorize_url()
# authorize_url = start_auth_flow(client)
logger.debug(f"successfully got auth url for client {client_id}")
return utils.ok(
result = {"url": authorize_url, "session_id": session_client.verifier},
msg = f'Please go to the URL and login.'
)
try:
session_client = client.oauth2_start_flow(refresh_tokens=True, requested_scopes=SCOPE)

authorize_url = client.oauth2_get_authorize_url()
# authorize_url = start_auth_flow(client)
logger.debug(f"successfully got auth url for client {client_id}")
return utils.ok(
result = {"url": authorize_url, "session_id": session_client.verifier},
msg = f'Please go to the URL and login.'
)
except Exception as e:
logger.exception(e.__cause__)

class TokensResource(Resource):
"""
Expand Down

0 comments on commit 4a1c359

Please sign in to comment.