Fix login callback (#489)
This commit is contained in:
parent
3f6c7a5595
commit
32292d4b39
4 changed files with 9 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ import os
|
||||||
PROD_CLOUD_HOST = "cloud.arcade.dev"
|
PROD_CLOUD_HOST = "cloud.arcade.dev"
|
||||||
PROD_ENGINE_HOST = "api.arcade.dev"
|
PROD_ENGINE_HOST = "api.arcade.dev"
|
||||||
LOCALHOST = "localhost"
|
LOCALHOST = "localhost"
|
||||||
|
LOCAL_AUTH_CALLBACK_PORT = 9905
|
||||||
|
|
||||||
# The path to the directory containing the Arcade configuration files. Typically ~/.arcade
|
# The path to the directory containing the Arcade configuration files. Typically ~/.arcade
|
||||||
ARCADE_CONFIG_PATH = os.path.join(os.path.expanduser(os.getenv("ARCADE_WORK_DIR", "~")), ".arcade")
|
ARCADE_CONFIG_PATH = os.path.join(os.path.expanduser(os.getenv("ARCADE_WORK_DIR", "~")), ".arcade")
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ def login(
|
||||||
help="The port of the Arcade Cloud host (if running locally).",
|
help="The port of the Arcade Cloud host (if running locally).",
|
||||||
),
|
),
|
||||||
callback_host: str = typer.Option(
|
callback_host: str = typer.Option(
|
||||||
"localhost",
|
None,
|
||||||
"--callback-host",
|
"--callback-host",
|
||||||
help="The host to use to complete the auth flow - this should be the same as the host that the CLI is running on. Include the port if needed.",
|
help="The host to use to complete the auth flow - this should be the same as the host that the CLI is running on. Include the port if needed.",
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ from rich.text import Text
|
||||||
from typer.core import TyperGroup
|
from typer.core import TyperGroup
|
||||||
from typer.models import Context
|
from typer.models import Context
|
||||||
|
|
||||||
from arcade_cli.constants import LOCALHOST
|
from arcade_cli.constants import LOCAL_AUTH_CALLBACK_PORT, LOCALHOST
|
||||||
|
|
||||||
console = Console()
|
console = Console()
|
||||||
|
|
||||||
|
|
@ -188,9 +188,12 @@ def compute_login_url(
|
||||||
else:
|
else:
|
||||||
callback_uri = callback_host
|
callback_uri = callback_host
|
||||||
if not callback_uri.rstrip("/").endswith("/callback"):
|
if not callback_uri.rstrip("/").endswith("/callback"):
|
||||||
|
if port:
|
||||||
|
callback_uri = callback_uri.rstrip("/") + f":{port}" + "/callback"
|
||||||
|
else:
|
||||||
callback_uri = callback_uri.rstrip("/") + "/callback"
|
callback_uri = callback_uri.rstrip("/") + "/callback"
|
||||||
else:
|
else:
|
||||||
callback_uri = f"http://{LOCALHOST}:9905/callback"
|
callback_uri = f"http://{LOCALHOST}:{LOCAL_AUTH_CALLBACK_PORT}/callback"
|
||||||
|
|
||||||
params = urlencode({"callback_uri": callback_uri, "state": state})
|
params = urlencode({"callback_uri": callback_uri, "state": state})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "arcade-ai"
|
name = "arcade-ai"
|
||||||
version = "2.0.5"
|
version = "2.0.6"
|
||||||
description = "Arcade.dev - Tool Calling platform for Agents"
|
description = "Arcade.dev - Tool Calling platform for Agents"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = {file = "LICENSE"}
|
license = {file = "LICENSE"}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue