diff --git a/dvc/commands/studio.py b/dvc/commands/studio.py index 085dd6592..49009bfff 100644 --- a/dvc/commands/studio.py +++ b/dvc/commands/studio.py @@ -31,12 +31,13 @@ class CmdStudioLogin(CmdConfig): "logout using 'dvc studio logout'." ) + open_browser = not self.args.no_open try: _, access_token = get_access_token( token_name=name, hostname=hostname, scopes=scopes, - use_device_code=self.args.no_open, + open_browser=open_browser, client_name="DVC", ) except StudioAuthError as e: diff --git a/pyproject.toml b/pyproject.toml index c0ab08319..42deb2c6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,7 @@ dependencies = [ "dvc-data>=3.10,<3.12", "dvc-http>=2.29.0", "dvc-render>=1.0.1,<2", - "dvc-studio-client>=0.17.1,<1", + "dvc-studio-client>=0.19,<1", "dvc-task>=0.3.0,<1", "flatten_dict<1,>=0.4.1", # https://github.com/iterative/dvc/issues/9654 diff --git a/tests/unit/command/test_studio.py b/tests/unit/command/test_studio.py index 20d1b4ca0..6484d71c4 100644 --- a/tests/unit/command/test_studio.py +++ b/tests/unit/command/test_studio.py @@ -1,4 +1,4 @@ -from dvc_studio_client.auth import AuthenticationExpired +from dvc_studio_client.auth import AuthorizationExpiredError from dvc.cli import main from dvc.utils.studio import STUDIO_URL @@ -6,9 +6,9 @@ from dvc.utils.studio import STUDIO_URL def test_studio_login_token_check_failed(mocker): mocker.patch( - "dvc_studio_client.auth.get_access_token", side_effect=AuthenticationExpired + "dvc_studio_client.auth.get_access_token", + side_effect=AuthorizationExpiredError, ) - assert main(["studio", "login"]) == 1 @@ -52,8 +52,8 @@ def test_studio_login_arguments(mocker): token_name="token_name", hostname="https://example.com", scopes="experiments", - use_device_code=True, client_name="DVC", + open_browser=False, )