Unverified Commit 9679b068 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

symphony/client: separate calls for guest token and link

parent 3fc4a62d
...@@ -27,7 +27,7 @@ import typing ...@@ -27,7 +27,7 @@ import typing
import contextlib import contextlib
import json import json
from simbricks.utils import base as utils_base from simbricks.utils import base as utils_base
from .auth import TokenProvider from .auth import Token, TokenProvider
from .settings import client_settings from .settings import client_settings
from simbricks.orchestration import system from simbricks.orchestration import system
from simbricks.orchestration import simulation from simbricks.orchestration import simulation
...@@ -198,10 +198,22 @@ class OrgClient: ...@@ -198,10 +198,22 @@ class OrgClient:
} }
async with self._base_client.post(url=self._prefix(org, "/create-guest"), async with self._base_client.post(url=self._prefix(org, "/create-guest"),
json=namespace_json) as resp: json=namespace_json) as resp:
j = await resp.json() await resp.json()
print(j)
return await j["magic_link"] async def guest_token(self, org: str, email: str) -> Token:
j = {
"email": email,
}
async with self._base_client.post(url=self._prefix(org, "/guest-token"), json=j) as resp:
tok = await resp.json()
return Token.parse_from_resp(tok)
async def guest_magic_link(self, org: str, email: str) -> str:
j = {
"email": email,
}
async with self._base_client.post(url=self._prefix(org, "/guest-magic-link"), json=j) as resp:
return (await resp.json())['magic_link']
class NSClient: class NSClient:
def __init__(self, base_client: BaseClient = BaseClient(), namespace: str = ""): def __init__(self, base_client: BaseClient = BaseClient(), namespace: str = ""):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment