Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Login passthrough
run: lightning login # since we are providing the credentials, this should be a no-op
env:
LIGHTNING_API_KEY: dummy-api-key
LIGHTNING_AUTH_TOKEN: dummy-auth-token

- name: Tests
working-directory: python/tests
Expand Down
2 changes: 1 addition & 1 deletion python/lightning_sdk/cli/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def login(no_browser: bool) -> None:
if no_browser and not oidc_login_enabled():
raise click.UsageError("`lightning login --no-browser` is not available yet.")
auth = Auth()
if auth.api_key or auth.auth_token:
if auth.auth_token:
click.echo('"lightning login" is not required within a Studio or when credentials are set in the environment')
return

Expand Down
4 changes: 2 additions & 2 deletions python/lightning_sdk/cli/resource_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
def has_credentials() -> bool:
"""Check for existing credentials without starting the browser login flow."""
auth = Auth()
if auth.api_key or auth.auth_token:
if auth.auth_token:
return True
if not auth.load():
return False
return bool(auth.api_key or auth.auth_token)
return bool(auth.auth_token)


def accessible_teamspaces() -> dict[str, dict[str, str]]:
Expand Down
2 changes: 1 addition & 1 deletion python/lightning_sdk/cli/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def _login_with_session_token(self: AuthServer, auth: Auth) -> None:
)
raise RuntimeError(
"Failed to authenticate to Lightning. When running without access to a browser, "
"'LIGHTNING_API_KEY' should be exported."
"'LIGHTNING_AUTH_TOKEN' should be exported."
)

@app.get("/login-complete")
Expand Down
2 changes: 1 addition & 1 deletion python/lightning_sdk/cli/utils/lockdown_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _auth_header() -> Optional[str]:
Reads the saved credentials unless the environment sets some, as the rest of the CLI does.
"""
auth = Auth()
if not (auth.api_key or auth.auth_token):
if not auth.auth_token:
auth.load()
try:
return auth.get_auth_header()
Expand Down
2 changes: 1 addition & 1 deletion python/lightning_sdk/cli/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

def _auth_header_without_browser() -> Optional[str]:
auth = Auth()
if not (auth.api_key or auth.auth_token):
if not auth.auth_token:
try:
if not auth.load():
return None
Expand Down
Loading
Loading