From ada46d8c65c50951af24747c2be16f1f6161350b Mon Sep 17 00:00:00 2001 From: "Carl A. Adams" Date: Thu, 22 May 2025 22:30:10 -0700 Subject: [PATCH 1/2] updates from beta feedback for improved login CLI experience. --- planet/auth.py | 2 ++ planet/cli/cli.py | 6 +++++- pyproject.toml | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/planet/auth.py b/planet/auth.py index 385a50f6..c0cc0699 100644 --- a/planet/auth.py +++ b/planet/auth.py @@ -92,6 +92,8 @@ def from_profile(profile_name: str) -> Auth: This method does not support the use a custom storage provider. """ + if not profile_name: + raise APIKeyAuthException('Profile name cannot be empty.') pl_authlib_context = planet_auth_utils.PlanetAuthFactory.initialize_auth_client_context( auth_profile_opt=profile_name) return _PLAuthLibAuth(plauth=pl_authlib_context) diff --git a/planet/cli/cli.py b/planet/cli/cli.py index 0c900bcd..2b63cd03 100644 --- a/planet/cli/cli.py +++ b/planet/cli/cli.py @@ -70,12 +70,16 @@ def _configure_cli_auth_ctx(ctx, auth_client_secret, auth_api_key): # planet-auth library Auth context type + # Embedded click commands imported from planet_auth_utils expect + # this in the 'AUTH' context field. ctx.obj[ 'AUTH'] = planet_auth_utils.PlanetAuthFactory.initialize_auth_client_context( auth_profile_opt=auth_profile, auth_client_id_opt=auth_client_id, auth_client_secret_opt=auth_client_secret, - auth_api_key_opt=auth_api_key) + auth_api_key_opt=auth_api_key, + use_env=True, + use_configfile=True) # planet SDK Auth context type ctx.obj['PLSDK_AUTH'] = planet.Auth._from_plauth( diff --git a/pyproject.toml b/pyproject.toml index b3725d35..4660cab4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ dependencies = [ "pyjwt>=2.1", "tqdm>=4.56", "typing-extensions", - "planet-auth==2.0.11b1746663950", + "planet-auth==2.0.11b1746663950", # TODO - update ] readme = "README.md" requires-python = ">=3.9" From a9f5731cbba2d5faa9ad25cca1e162a190c954e5 Mon Sep 17 00:00:00 2001 From: "Carl A. Adams" Date: Fri, 23 May 2025 11:38:04 -0700 Subject: [PATCH 2/2] plumb profile copy --- planet/cli/auth.py | 1 + 1 file changed, 1 insertion(+) diff --git a/planet/cli/auth.py b/planet/cli/auth.py index c3ef0b1e..514a008d 100644 --- a/planet/cli/auth.py +++ b/planet/cli/auth.py @@ -69,4 +69,5 @@ def cmd_auth_profile(ctx): cmd_auth_profile.add_command(name="show", cmd=planet_auth_utils.cmd_profile_show) cmd_auth_profile.add_command(name="set", cmd=planet_auth_utils.cmd_profile_set) +cmd_auth_profile.add_command(name="copy", cmd=planet_auth_utils.cmd_profile_copy) cmd_auth.add_command(cmd_auth_profile)