Skip to content

Commit e14228d

Browse files
committed
refactor(examples): improve security posture and authentication guidance
- Add a Trivy security scanning badge to the README - Update the authentication example to use DiscoveryClient for endpoint discovery instead of manually importing and passing endpoints Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
1 parent 146c88d commit e14228d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![PyPI](https://img.shields.io/pypi/v/go-authgate)](https://pypi.org/project/go-authgate/)
44
[![Python](https://img.shields.io/pypi/pyversions/go-authgate)](https://pypi.org/project/go-authgate/)
55
[![CI](https://github.com/go-authgate/sdk-python/actions/workflows/testing.yml/badge.svg)](https://github.com/go-authgate/sdk-python/actions/workflows/testing.yml)
6+
[![Trivy](https://github.com/go-authgate/sdk-python/actions/workflows/trivy.yml/badge.svg)](https://github.com/go-authgate/sdk-python/actions/workflows/trivy.yml)
67
[![License](https://img.shields.io/pypi/l/go-authgate)](LICENSE)
78

89
Python SDK for [AuthGate](https://github.com/go-authgate) — OAuth 2.0 authentication and token management.
@@ -50,11 +51,14 @@ client, token = await async_authenticate(
5051
## Client Credentials (M2M)
5152

5253
```python
53-
from authgate.oauth import OAuthClient, Endpoints
54+
from authgate.discovery.client import DiscoveryClient
55+
from authgate.oauth import OAuthClient
5456
from authgate.clientcreds import TokenSource, BearerAuth
5557
import httpx
5658

57-
client = OAuthClient("my-service", endpoints, client_secret="secret")
59+
disco = DiscoveryClient("https://auth.example.com")
60+
meta = disco.fetch()
61+
client = OAuthClient("my-service", meta.to_endpoints(), client_secret="secret")
5862
ts = TokenSource(client, scopes=["api"])
5963

6064
# Auto-attaches Bearer token to every request

0 commit comments

Comments
 (0)