Search code examples
nats.ioargo-workflowsnats-streaming-server

How to pass token to NATS server using nats-pub.py script


I am new in NATS.
Please can you provide how to pass token to NATS server using nats-pub.py script.
python /tmp/nats-pub.py --creds ? -s nats://eventbus-default-stan-svc:4222 {label} -d '{json}'
I can get NATS access configuration

"config": {
    "nats": {
        "accessSecret": {
            "key": "client-auth",
            "name": "eventbus-default-client"
        },
        "auth": "token",
        "clusterID": "eventbus-default",
        "url": "nats://eventbus-default-stan-svc:4222"
    }
}

How to configure request to pass authorization because now I get Error: nats: 'Authorization Violation'.


Solution

  • This is not possible in current version of nats-pub.py because this is not implemented there. I have commited new version of nats-pub.py. There is implemented --token switch.