This is an automated email from the ASF dual-hosted git repository. penghui pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push: new cd8b7c7 Add python oauth2 document (#7946) cd8b7c7 is described below commit cd8b7c77bce19e3f864dd708d5d9bb15b7ead128 Author: Yong Zhang <zhangyong1025...@gmail.com> AuthorDate: Wed Sep 2 21:17:54 2020 +0800 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 41b660f..5945218 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)) +```