-
Notifications
You must be signed in to change notification settings - Fork 44
Description
The higher level ClientApp adds openid as a default scope. This doesn't seem to be documented on the class:
globus-sdk-python/src/globus_sdk/globus_app/client_app.py
Lines 48 to 49 in c8f27b8
| :param scope_requirements: A mapping of resource server to initial scope | |
| requirements. |
Also, seemingly you can't even stop it doing that:
>>> globus_sdk.ClientApp(client_id=..., client_secret=...).scope_requirements
>>> {'auth.globus.org': [Scope('openid')]}
>>> globus_sdk.ClientApp(client_id=..., client_secret=..., scope_requirements={}).scope_requirements
{'auth.globus.org': [Scope('openid')]}
>>> globus_sdk.ClientApp(client_id=..., client_secret=..., scope_requirements={globus_sdk.scopes.TransferScopes.resource_server: globus_sdk.scopes.TransferScopes.all}).scope_requirements
{'transfer.api.globus.org': [Scope('urn:globus:auth:scope:transfer.api.globus.org:all')], 'auth.globus.org': [Scope('openid')]}On the other hand, the lower level globus_sdk.ConfidentialAppAuthClient.oauth2_start_flow is documented as adding this scope by default.
globus-sdk-python/src/globus_sdk/services/auth/client/confidential_client.py
Lines 115 to 116 in c8f27b8
| :param requested_scopes: The scopes on the token(s) being requested. Defaults to | |
| ``openid profile email urn:globus:auth:scope:transfer.api.globus.org:all`` |
Unlike ClientApp, you can override this by just passing in a custom scope:
globus_sdk.ConfidentialAppAuthClient(...).oauth2_start_flow(..., requested_scopes=...)What this means is that if you pass the exact same scopes list to both of these objects, then the ConfidentialAppAuthClient will generate tokens that are not compatible with the ClientApp! This causes a confusing error AuthAPIError: ('POST', 'https://auth.globus.org/v2/oauth2/token', 'Basic', 403, 'REQUIRED_IDENTITY_MISSING', "In order to access 'APP NAME', you need to link an identity from ORG NAME to your account.", 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx)
Some helpful changes might include:
- Documenting this
openidbehaviour inClientApp - Making the two clients consistent in whether they do or don't add
openidscopes - Add a
ClientApp.clear_scope_requirements(). Currently I doClientApp._scope_requirements = {}to remove theopenidscope that I don't want - Improve the error message when you have tokens that are valid but whose scopes are mismatched