-
Notifications
You must be signed in to change notification settings - Fork 19
Reauth SDK when desktop app is locked #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reauth SDK when desktop app is locked #193
Conversation
This class stores the client ID, the core used for making requests and the client config. This Inner client is capable of overriding its client id in case the desktop session expires due to the app getting locked.
The new exception added now matches the naming convention for typed errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One issue I ran into while testing is that if the desktop app is locked before the client is released, release_client will cause a prompt to show up and will block until the prompt is approved / denied.
You can reproduce this easily by running a script that authenticates a client, sleeps, then you can manually lock the desktop app and cancel the script by hitting command / ctrl + C twice. You'll be prompted again and you'll see the behavior I described above.
The DesktopSessionExpiredException should not really be returned when we're trying to release a client, since if the desktop app has already cleaned up the client and its session, calling release_client should just be a no-op.
Thanks for pointing this out. This will be addressed on the Desktop app side. Therefore, this doesn't block this PR from getting merged. |
📋 Summary
This PR adjust the behavior of the SDK in the following scenario:
A program running the SDK initializes a new client that authenticates via the Desktop app. After the client is initialized, the Desktop app gets locked. User will be re-prompted to authorize the SDK. However, after the confirmation, any operation will now fail since the session no longer exists.
🤔 Thought process
Currently, the approach is to catch the new error thrown by the SDK in this scenario:
DesktopSessionExpiredException. If received, the client will do the following: