Ecwid / consul-api

Java client for Consul HTTP API
Apache License 2.0
416 stars 177 forks source link

Can't authenticate to local agent #209

Open gaspo53 opened 3 years ago

gaspo53 commented 3 years ago

Hi. I'm trying to get a value from KV, and search for a service. But I couldn't find any way to pass a token in order to authenticate the requests. The response I'm having is: OperationException{statusCode=403, statusMessage='Forbidden', statusContent='rpc error making call: rpc error making call: Permission denied'} at com.ecwid.consul.v1.kv.KeyValueConsulClient.getKVValue(KeyValueConsulClient.java:86) at com.ecwid.consul.v1.kv.KeyValueConsulClient.getKVValue(KeyValueConsulClient.java:64) at com.ecwid.consul.v1.kv.KeyValueConsulClient.getKVValue(KeyValueConsulClient.java:54) at com.ecwid.consul.v1.ConsulClient.getKVValue(ConsulClient.java:589) at com.siriusxm.esb.main.JmsApp.getConsulProviders(JmsApp.java:286) at com.siriusxm.esb.main.JmsApp.main(JmsApp.java:152)

And the client config:

` ConsulClient client = new ConsulClient("localhost"); GetValue getValue = client.getKVValue(activeSitePath).getValue();

// Services HealthServicesRequest request = HealthServicesRequest.newBuilder() .setTags(tags.toArray(new String[tags.size()])) .setPassing(true) .setQueryParams(QueryParams.DEFAULT) .build(); Response<List> healthyServices = client.getHealthServices(serviceName, request); `

Thanks in advance