From b4458a5baf0ecfe689487cea862e58225f441431 Mon Sep 17 00:00:00 2001 From: Wei Ouyang Date: Sat, 28 Sep 2024 14:21:02 -0700 Subject: [PATCH] Update change logs and login instructions --- CHANGELOG.md | 8 ++++++++ docs/getting-started.md | 24 ++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5fba2c7..ff7ed89e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Hypha Change Log +### 0.20.38 + - Allow passing workspace and expires_in to the `login` function to generate workspace specific token. + - When using http endpoint to access the service, you can now pass workspace specific token to the http header `Authorization` to access the service. (Previously, all the services are assumed to be accessed from the same service provider workspace) + +### 0.20.37 + - Add s3-proxy to allow accessing s3 presigned url in case the s3 server is not directly accessible. Use `--enable-s3-proxy` to enable the s3 proxy when starting Hypha. + - Add `artifact-manager` service to provide comprehensive artifact management, used for creating gallery-like service portal. The artifact manager service is backed by s3 storage and supports presigned url for direct access to the artifacts. This is a replacement of the previous `card` service. + ### 0.20.36 - Upgrade hypha-rpc to support updating reconnection token (otherwise it generate token expired error after some time) diff --git a/docs/getting-started.md b/docs/getting-started.md index 6af809f0..96bba80e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -250,7 +250,7 @@ By default all the clients connected to Hypha server communicate via the websock ### User Login and Token-Based Authentication -To access the full features of the Hypha server, users need to log in and obtain a token for authentication. The new `login()` function provides a convenient way to display a login URL, once the user click it and login, it can then return the token for connecting to the server. +To access the full features of the Hypha server, users need to log in and obtain a token for authentication. The `login()` function provides a convenient way to display a login URL, once the user click it and login, it can then return the token for connecting to the server. Here is an example of how the login process works using the `login()` function: @@ -294,7 +294,27 @@ The output will provide a URL for the user to open in their browser and perform the login process. Once the user clicks the link and successfully logs in, the `login()` function will return, providing the token. -The `login()` function also supports additional arguments: +#### Additional Arguments for Login + +You can specify the `workspace` and `expires_in` arguments in the `login()` function so that the token is generated for a specific workspace and expires after a certain period of time. + +```python +token = await login( + { + "server_url": SERVER_URL, + "workspace": "my-workspace", + "expires_in": 3600, + } +) +``` + +If a token is generated for a specific workspace, when calling `connect_to_server`, you need to specify the same workspace as well: + +```python +server = await connect_to_server({"server_url": "https://ai.imjoy.io", "token": token, "workspace": "my-workspace"}) +``` + +The `login()` function also supports other additional arguments: ```python token = await login(