@@ -30,9 +30,10 @@ class CloudAPIError(Exception):
3030
3131 pass
3232
33+
3334# TODO this is the workos dev env
34- CLI_OAUTH_CLIENT_ID = "client_01K46RED2BW9YKYE4N7Y9BDN2V"
35- AUTHKIT_DOMAIN = "https://exciting-aquarium-32-staging.authkit.app"
35+ CLI_OAUTH_CLIENT_ID = "client_01K46RED2BW9YKYE4N7Y9BDN2V"
36+ AUTHKIT_DOMAIN = "https://exciting-aquarium-32-staging.authkit.app"
3637
3738
3839async def make_api_request (
@@ -48,15 +49,14 @@ async def make_api_request(
4849 headers .update (auth_headers )
4950 async with httpx .AsyncClient (timeout = timeout ) as client :
5051 try :
51- response = await client .request (
52- method = method , url = url , headers = headers , json = json_data
53- )
52+ response = await client .request (method = method , url = url , headers = headers , json = json_data )
5453 console .print (response )
5554 response .raise_for_status ()
5655 return response
5756 except httpx .HTTPError as e :
5857 raise CloudAPIError (f"API request failed: { e } " ) from e
5958
59+
6060async def get_authenticated_headers () -> dict [str , str ]:
6161 """Get authentication headers with JWT token."""
6262 auth = CLIAuth (client_id = CLI_OAUTH_CLIENT_ID , authkit_domain = AUTHKIT_DOMAIN )
@@ -73,9 +73,7 @@ def login():
7373 """Authenticate with WorkOS using OAuth Device Authorization flow."""
7474
7575 async def _login ():
76- auth = CLIAuth (
77- client_id = CLI_OAUTH_CLIENT_ID , authkit_domain = AUTHKIT_DOMAIN
78- )
76+ auth = CLIAuth (client_id = CLI_OAUTH_CLIENT_ID , authkit_domain = AUTHKIT_DOMAIN )
7977
8078 success = await auth .login ()
8179 if not success :
@@ -84,6 +82,7 @@ async def _login():
8482
8583 asyncio .run (_login ())
8684
85+
8786@cloud_app .command ("list" )
8887def list_projects (
8988 host_url : str = typer .Option (..., "--host" , "-h" , help = "Cloud host URL" ),
@@ -97,9 +96,7 @@ def list_projects(
9796 console .print (f"[blue]Fetching projects from { host_url } ...[/blue]" )
9897
9998 # Make API request to list projects
100- response = asyncio .run (
101- make_api_request (method = "GET" , url = f"{ host_url } /projects/projects" )
102- )
99+ response = asyncio .run (make_api_request (method = "GET" , url = f"{ host_url } /projects/projects" ))
103100
104101 projects_data = response .json ()
105102
0 commit comments