nats.go: BUG: a Client can't authorize by a token
I’ve tried a client authorization by token and always get the error:
sergey@debian:~/go/src/gitlab.com/sarbash/tms-notifyd$ go run main.go
2017/08/19 21:52:45 nats: authorization violation
exit status 1
The code is as follows:
const (
natsServer = `nats://xxxxxx.yyyyyyyy.ru:4222`
orderSubj = `orders.Update`
natsToken = "$xx$xx$XXxXXXXXXXxXxxxxXXXxXXXxXXxxXxXXxXXXXXXxXXxX/XxxxXXxX"
)
func main() {
natsConnection, err := nats.Connect(natsServer, nats.Token(natsToken))
if err != nil {
log.Fatalln(err)
}
log.Println("Connected to NATS")
// Subscribe to subject
cb := msgHandler
log.Printf("Subscribing to subject '%s'\n", orderSubj)
natsConnection.Subscribe(orderSubj, cb)
// Keep the connection alive
runtime.Goexit()
}
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (5 by maintainers)
The following configuration works for me with nats-server version 1.0.0: