Skip to content

gare.to_dict() returns excessive query parameters #1425

Description

@multimeric

I'm trying to use GAREs + GlobusAuthorizationCodeFlowManager by following these docs. The problem is that GlobusAuthorizationParameters.to_dict() returns parameters even when they're "empty", which the globus auth endpoint rejects.

Here is an example where I've caught GlobusAPIError as e:

>>> e
TransferAPIError('GET', 'https://transfer.api.globus.org/v0.10/operation/endpoint/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/ls', 'Bearer', 403, 'PermissionDenied', 'No effective ACL rules on the high-assurance endpoint xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)\nAvailable Identity IDs: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy', 'aaaaaaaaa')
>>> e.raw_json
{'authorization_parameters': {'session_message': 'Session reauthentication required (Globus Transfer)', 'session_required_identities': [...], 'session_required_mfa': False, 'session_required_single_domain': [...]}, 'code': 'PermissionDenied', 'message': 'No effective ACL rules on the high-assurance endpoint xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxx... IDs: yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy', 'request_id': 'bbbbbbbbb', 'resource': '/operation/endpoint/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/ls'}
>>> gare = to_gare(e)
>>> gare.authorization_parameters.to_dict()
{'session_message': 'Session reauthentication required (Globus Transfer)', 'session_required_identities': ['yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy'], 'session_required_single_domain': [], 'session_required_mfa': False}
>>> manager.get_authorize_url(query_params=query_params.to_dict())
'https://auth.globus.org/v2/oauth2/authorize?client_id=zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz&redirect_uri=http%3A%2F%2Flocalhost%3A8084%2Fv1%2Fglobus%2Fredirect&scope=urn%3Aglobus%3Aauth%3Ascope%3Atransfer.api.globus.org%3Aall&state=http%3A%2F%2Flocalhost%3A8081%2Frequest%3Fdatasource%3Dglobus_test%26globusAuthenticated%3Dtrue&response_type=code&access_type=offline&session_message=Session+reauthentication+required+%28Globus+Transfer%29&session_required_identities=%5B%27yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy%27%5D&session_required_single_domain=%5B%5D&session_required_mfa=False&prompt=login'

Note how gare.authorization_parameters.to_dict() includes session_required_single_domain and session_required_identities, which can't be used simultaneously.

If a user then browses to that authorize URL, they will get:
Image

Now I recognize that the above docs involve use of a UserApp instead of a GlobusAuthorizationCodeFlowManager like I'm doing here, which works at a lower level. However it would be nice to be able to pull out a valid set of query parameters from GlobusAuthorizationParameters. Even better if it added {"prompt": "login"} for me.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions