dwavesystems / dwave-cloud-client

A minimal implementation of the REST interface used to communicate with D-Wave Solver API (SAPI) servers.
https://docs.ocean.dwavesys.com/projects/cloud-client/en/stable/
Apache License 2.0
59 stars 40 forks source link

dwave auth login does not time out for target website failure #589

Closed JoelPasvolsky closed 1 year ago

JoelPasvolsky commented 1 year ago

If I run dwave auth login and the target website has a problem (Something went wrong We apologize for the inconvenience. Check our...) the terminal hangs and does not time out (at least not for many minutes, beyond what one can be expected to wait).

The terminal is stuck in the following state and user control is not restored with CNTRL-C:

Please visit the following URL to authorize Ocean: https://...uthorize?response_type=code&client_id=80...&redirect_uri=http%3A%2F%2F127.0.0.1%3A36000%2F&scope=openid+get_token&state=ab2sl6Z6...D&code_challenge=fUAq_U...QuG90&code_challenge_method=S256

Expectation: should time out or CNTRL-C should work.

This is for a WIN10 OS. (Looks like CNTL_C works fine for Unix)

randomir commented 1 year ago

We have a support for timeout, but it defaults to no-timeout, at least for now.

https://github.com/dwavesystems/dwave-cloud-client/blob/3cf03b2edd557a772e5b9d71ced06bc69561f20a/dwave/cloud/auth/flows.py#L330-L331

But regardless of timeout, Ctrl+C should work, and it works on my machine (tm). :laughing:

randomir commented 1 year ago

To close this one, no timeout is by design. I can't imagine what would be a reasonable timeout value for waiting user to authorize Ocean.. Maybe they first need to sign-up for Leap, maybe their MFA is not arriving, etc. The only reasonable option, IMO is to allow Ctrl+C (or equivalent on Windows/Powershell) to cancel auth, and we already allow that.