Skip to content

Commit 19ad60e

Browse files
docs: Update README.md with authentication info
1 parent cccba1a commit 19ad60e

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,43 @@
33
The Glean Python SDK provides convenient access to the Glean REST API from any Python 3.8+ application. It includes type hints for all request parameters and response fields, and supports both synchronous and asynchronous usage via [httpx](https://www.python-httpx.org/).
44
<!-- No Summary [summary] -->
55

6+
## Unified SDK Architecture
7+
8+
This SDK combines both the Client and Indexing API namespaces into a single unified package:
9+
10+
- **Client API**: Used for search, retrieval, and end-user interactions with Glean content
11+
- **Indexing API**: Used for indexing content, permissions, and other administrative operations
12+
13+
Each namespace has its own authentication requirements and access patterns. While they serve different purposes, having them in a single SDK provides a consistent developer experience across all Glean API interactions.
14+
15+
```python
16+
# Example of accessing Client namespace
17+
from glean import Glean, models
18+
import os
19+
20+
with Glean(bearer_auth="client-token") as glean:
21+
search_response = glean.client.search.query(
22+
search_request=models.SearchRequest(query="search term")
23+
)
24+
print(search_response)
25+
26+
# Example of accessing Indexing namespace
27+
from glean import Glean, models
28+
import os
29+
30+
with Glean(bearer_auth="indexing-token") as glean:
31+
document_response = glean.indexing.documents.index(
32+
document=models.Document(
33+
id="doc-123",
34+
title="Sample Document",
35+
container_id="container-456",
36+
datasource="confluence"
37+
)
38+
)
39+
```
40+
41+
Remember that each namespace requires its own authentication token type as described in the [Authentication Methods](#authentication-methods) section.
42+
643
<!-- Start Table of Contents [toc] -->
744
## Table of Contents
845
<!-- $toc-max-depth=2 -->
@@ -204,6 +241,35 @@ with Glean(
204241
```
205242
<!-- End Authentication [security] -->
206243

244+
### Authentication Methods
245+
246+
Glean supports different authentication methods depending on which API namespace you're using:
247+
248+
#### Client Namespace
249+
250+
The Client namespace supports two authentication methods:
251+
252+
1. **Manually Provisioned API Tokens**
253+
- Can be created by an Admin or a user with the API Token Creator role
254+
- Used for server-to-server integrations
255+
256+
2. **OAuth**
257+
- Requires OAuth setup to be completed by an Admin
258+
- Used for user-based authentication flows
259+
260+
#### Indexing Namespace
261+
262+
The Indexing namespace supports only one authentication method:
263+
264+
1. **Manually Provisioned API Tokens**
265+
- Can be created by an Admin or a user with the API Token Creator role
266+
- Used for secure document indexing operations
267+
268+
> [!IMPORTANT]
269+
> Client tokens **will not work** for Indexing operations, and Indexing tokens **will not work** for Client operations. You must use the appropriate token type for the namespace you're accessing.
270+
271+
For more information on obtaining the appropriate token type, please contact your Glean administrator.
272+
207273
<!-- Start Available Resources and Operations [operations] -->
208274
## Available Resources and Operations
209275

0 commit comments

Comments
 (0)