globus / globus-sdk-python

Globus SDK for Python
Apache License 2.0
68 stars 36 forks source link

Add `GlobusApp` method to check login status #1036

Closed rjmello closed 1 month ago

rjmello commented 2 months ago

GlobusApp objects currently enable users to manually trigger a login flow via app.run_login_flow(), but not to check if a user already has valid tokens (i.e., logged in). I can accomplish this by interacting with the app._validating_token_storage object, but that is not a public interface, nor intuitive.

I propose creating an app.is_logged_in() method, or similar, which supports a resource_server argument. If the user does not specify a resource server, then the method could validate tokens for all associated resource servers.

In addition, we might consider creating an app.ensure_logged_in() method, or similar, which would simply run app.run_login_flow() if app.is_logged_in() returns False.

derek-globus commented 1 month ago

https://github.com/globus/globus-sdk-python/pull/1041

derek-globus commented 1 month ago

pr-1041 resolves this issue.

We'll be releasing SDKv3.45.0 later today which includes this change. We have released SDKv3.45.0 which includes these changes.