mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
auth: align all SDK packages to canonical <org>-<app> client ids
IAM seeds apps as <org>-<app> (iam cmd/iam/cli/init_apps.go:57-59): hanzo-app, zoo-app, lux-app — AppName == ClientID. Several packages used the inverted 'app-hanzo'/'app-hanzobot' or placeholder '*-client-id', none of which IAM knows — device/PKCE login would fail. One value, everywhere: - hanzoai/auth.py: login_with_pkce default -> IAM_CLIENT_ID (hanzo-app) - hanzo-cli/auth.py: DEFAULT_APP, DEFAULT_CLIENT_ID -> hanzo-app - hanzo/commands/auth.py: IAM_CLIENT_ID -> hanzo-app - hanzo-tools-auth/session.py: DEFAULT_APP, DEFAULT_CLIENT_ID -> hanzo-app - hanzo/commands/iam.py: --app default + doc example -> hanzo-app - hanzo-cli/bot/commands.py: BOT_IAM_APP/CLIENT_ID app-hanzobot -> hanzo-bot
This commit is contained in:
@@ -27,8 +27,8 @@ TOKEN_FILE = TOKEN_DIR / "token.json"
|
||||
|
||||
DEFAULT_IAM_URL = "https://hanzo.id"
|
||||
DEFAULT_ORG = "hanzo"
|
||||
DEFAULT_APP = "app-hanzo"
|
||||
DEFAULT_CLIENT_ID = "hanzo-app-client-id"
|
||||
DEFAULT_APP = "hanzo-app"
|
||||
DEFAULT_CLIENT_ID = "hanzo-app"
|
||||
CALLBACK_PORT = 8399
|
||||
CALLBACK_PATH = "/callback"
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ BOT_LOG_FILE = Path.home() / ".hanzo" / "bot" / "node.log"
|
||||
DEFAULT_GATEWAY_HOST = "gw.hanzo.bot"
|
||||
DEFAULT_GATEWAY_PORT = 443
|
||||
NPM_PACKAGE = "@hanzo/bot"
|
||||
BOT_IAM_CLIENT_ID = "hanzobot-client-id"
|
||||
BOT_IAM_CLIENT_ID = "hanzo-bot"
|
||||
BOT_IAM_SERVER_URL = "https://hanzo.id"
|
||||
BOT_IAM_ORG = "hanzo"
|
||||
BOT_IAM_APP = "app-hanzobot"
|
||||
BOT_IAM_APP = "hanzo-bot"
|
||||
BOT_CALLBACK_PORT = 8398
|
||||
BOT_CALLBACK_PATH = "/callback"
|
||||
BOT_TOKEN_FILE = Path.home() / ".hanzo" / "bot" / "token.json"
|
||||
@@ -577,9 +577,9 @@ class _BotOAuthCallbackHandler(http.server.BaseHTTPRequestHandler):
|
||||
def _bot_browser_login() -> str:
|
||||
"""Run browser OAuth login flow for the bot gateway.
|
||||
|
||||
Opens the user's browser to the IAM login page (hanzobot application),
|
||||
Opens the user's browser to the IAM login page (hanzo-bot application),
|
||||
starts a local HTTP server to receive the callback, exchanges the code
|
||||
for tokens scoped to hanzobot-client-id.
|
||||
for tokens scoped to the hanzo-bot client.
|
||||
|
||||
Returns:
|
||||
Access token string.
|
||||
@@ -672,7 +672,7 @@ def _bot_browser_login() -> str:
|
||||
def _bot_password_login(
|
||||
username: str | None = None, password: str | None = None
|
||||
) -> str:
|
||||
"""Login via password grant using the hanzobot client. Returns access_token."""
|
||||
"""Login via password grant using the hanzo-bot client. Returns access_token."""
|
||||
import time
|
||||
|
||||
import httpx
|
||||
@@ -730,7 +730,7 @@ def _get_iam_token() -> str:
|
||||
if token:
|
||||
return token
|
||||
|
||||
# Try stored bot-specific token (issued by hanzobot-client-id)
|
||||
# Try stored bot-specific token (issued by the hanzo-bot client)
|
||||
bot_data = _load_bot_token()
|
||||
if bot_data and bot_data.get("access_token"):
|
||||
return bot_data["access_token"]
|
||||
|
||||
Reference in New Issue
Block a user