From cd8b7c77bce19e3f864dd708d5d9bb15b7ead128 Mon Sep 17 00:00:00 2001 From: Yong Zhang Date: Wed, 2 Sep 2020 21:17:54 +0800 Subject: [PATCH] Add python oauth2 document (#7946) **Motivation** After #7813, the python client supports the oauth2 authentication as well. Add an example for it. --- site2/docs/security-oauth2.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/site2/docs/security-oauth2.md b/site2/docs/security-oauth2.md index 41b660f5fa1..594521894d0 100644 --- a/site2/docs/security-oauth2.md +++ b/site2/docs/security-oauth2.md @@ -132,3 +132,22 @@ client, err := pulsar.NewClient(pulsar.ClientOptions{ Authentication: oauth, }) ``` + +### Python client + +To enable OAuth2 authentication in Python client, you need to configure OAuth2 authentication. +This example shows how to configure OAuth2 authentication in Python client. + +```python +from pulsar import Client, AuthenticationOauth2 + +params = ''' +{ + "issuer_url": "https://dev-kt-aa9ne.us.auth0.com", + "private_key": "/path/to/privateKey", + "audience": "https://dev-kt-aa9ne.us.auth0.com/api/v2/" +} +''' + +client = Client("puslar://my-cluster:6650", authentication=AuthenticationOauth2(params)) +``` -- GitLab