Search code examples
apache-pulsarpython-pulsar

error 404 when try to make oauth in pulsar stream native cluster


Hello I am triying to connect to apache pulsar cluster using stream native, I don't have problems with token oauth, but when I try to make Oauth I always get malformed responde or 404 I am using curl and python client, and following their instructions,like this.

params = '''
{
    "issuer_url": "https://auth.streamnative.cloud/",
    "private_key": test.json",
    "audience": "urn:sn:pulsar:test:test"
}
'''

pulsar_client = pulsar.Client(
    PULSAR_URL,
    authentication=AuthenticationOauth2(params)
)

and the error is the following:

AuthOauth2:223 | Response failed for getting the well-known configuration https://auth.streamnative.cloud/. response Code 404

But the params and url I get from https://console.streamnative.cloud/test/test/clients, but nothing.

Any Idea about how can I connect to the cluster with the oauth?

EDIT

With client the credentials works, looks like a bug in python package of pulsar 2.9.1.

Thanks


Solution

  • You may need the full path to the private key. make sure it has permissions.

    also make sure your audience is correct

    what is pulsar URL format?

    pulsar+ssl://sn-myinstance.mycluster.snio.cloud:6651 
    

    I have an example python app here

    https://github.com/tspannhw/FLiP-Pi-BreakoutGarden/blob/c056b0eccc7ad18f8b18740bb30c224467991310/consume.sh

    client = pulsar.Client(args.service_url, authentication=AuthenticationOauth2(args.auth_params))
    

    https://docs.streamnative.io/cloud/stable/connect/client/connect-python

    https://github.com/streamnative/examples/blob/master/cloud/README.md

    Also make sure you gave the userid associated with your key permissions.

    If that doesn't work, chat with me on the Pulsar slack.