Oauth Login using extensions #1796
Unanswered
maurorosales
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
HI everyone !
I need help, I wanted to ask if anyone is working with extensions, since following the example, I find myself with the blocker that I don't know or can't pass the extensions required for authentication.
https://github.com/confluentinc/confluent-kafka-python/blob/master/examples/oauth_producer.py
I have tried
`
def _get_token(args, config):
payload = {
'grant_type': 'client_credentials',
'scope': ' '.join(args['scopes'])
}
resp = requests.post(args['token_url'],
auth=(args['client_id'], args['client_secret']),
data=payload)
token = resp.json()
ext ={'logicalCluster':'lkc-387rnw','identityPoolId':'pool-Pakz'}
#print(token['access_token'])
return token['access_token'], time.time() + float(token['expires_in']), ext
def producer_config(args):
return {
'bootstrap.servers': args['bootstrap_servers'],
'value.serializer': StringSerializer('utf_8'),
'security.protocol': 'SASL_SSL',
'sasl.mechanisms': 'OAUTHBEARER',
'oauth_cb': functools.partial(_get_token, args)
}
Or adding the extensions in the producer config {
'bootstrap.servers': args['bootstrap_servers'],
'value.serializer': StringSerializer('utf_8'),
'security.protocol': 'SASL_SSL',
'sasl.mechanisms': 'OAUTHBEARER',
'sasl.oauthbearer.extensions':'logicalCluster=lkc-387rnw,identityPoolId=pool-Pakz',
'oauth_cb': functools.partial(_get_token, args)
}`
Either way I get the same error
authentication error: Authentication failed: 1 extensions are invalid! They are: logicalCluster: CLUSTER_ID_MISSING_OR_EMPTY (after 5517ms in state AUTH_REQ)
Beta Was this translation helpful? Give feedback.
All reactions