Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 5a92afc

Browse files
committed
docs: Updated Usage Guide with Static API Token steps
Refs: chroma-core/chroma#1027
1 parent bc009cb commit 5a92afc

File tree

1 file changed

+58
-7
lines changed

1 file changed

+58
-7
lines changed

docs/usage-guide.md

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -720,13 +720,13 @@ You can configure Chroma to use authentication when in server/client mode only.
720720

721721
Supported authentication methods:
722722

723-
| Authentication Method | Basic Auth (Pre-emptive) |
724-
|-----------------------|---------------------------------------------------------------------------------------------------------------------------|
725-
| Description | [RFC 7617](https://www.rfc-editor.org/rfc/rfc7617) Basic Auth with `user:password` base64-encoded `Authorization` header. |
726-
| Status | `Alpha` |
727-
| Server-Side Support |`Alpha` |
728-
| Client/Python ||
729-
| Client/JS ||
723+
| Authentication Method | Basic Auth (Pre-emptive) | Static API Token |
724+
|-----------------------|---------------------------------------------------------------------------------------------------------------------------|------------------|
725+
| Description | [RFC 7617](https://www.rfc-editor.org/rfc/rfc7617) Basic Auth with `user:password` base64-encoded `Authorization` header. | |
726+
| Status | `Alpha` | |
727+
| Server-Side Support |`Alpha` |`Alpha` |
728+
| Client/Python || |
729+
| Client/JS |||
730730

731731
### Basic Authentication
732732

@@ -782,3 +782,54 @@ Authentication is not yet supported in JS
782782
:::
783783
</TabItem>
784784
</Tabs>
785+
786+
787+
### Static API Token Authentication
788+
789+
<Tabs queryString groupId="lang" className="hideTabSwitcher">
790+
<TabItem value="py" label="Python">
791+
792+
#### Server Setup
793+
794+
:::note Security Note
795+
Current implementation of static API token auth supports only ENV based tokens.
796+
:::
797+
798+
##### Running the Server
799+
800+
Create a `.chroma_env` file with the following contents:
801+
802+
```ini title=".chroma_env"
803+
CHROMA_SERVER_AUTH_CREDENTIALS="test-token" \
804+
CHROMA_SERVER_AUTH_CREDENTIALS_PROVIDER='chromadb.auth.token.TokenConfigServerAuthCredentialsProvider'
805+
CHROMA_SERVER_AUTH_PROVIDER='chromadb.auth.token.TokenAuthServerProvider'
806+
```
807+
808+
```bash
809+
docker-compose --env-file ./.chroma_env up -d --build
810+
```
811+
812+
#### Client Setup
813+
814+
```python
815+
import chromadb
816+
from chromadb.config import Settings
817+
818+
client = chromadb.HttpClient(
819+
settings=Settings(chroma_client_auth_provider="chromadb.auth.token.TokenAuthClientProvider",
820+
chroma_client_auth_credentials="test-token"))
821+
client.heartbeat() # this should work with or without authentication - it is a public endpoint
822+
823+
client.get_version() # this should work with or without authentication - it is a public endpoint
824+
825+
client.list_collections() # this is a protected endpoint and requires authentication
826+
```
827+
828+
</TabItem>
829+
<TabItem value="js" label="JavaScript">
830+
831+
:::info Not Available
832+
Authentication is not yet supported in JS
833+
:::
834+
</TabItem>
835+
</Tabs>

0 commit comments

Comments
 (0)