UNAUTHENTICATED: Expected bearer token at header with key [authorization], but found nothing

I am trying multitenancy on locally installed camunda self-managed with dockerhub.

I used docker-compose.yaml to create containers in the docker hub.

in the .env file
**
MULTI_TENANCY_ENABLED=true
ZEEBE_AUTHENTICATION_MODE=identity
**
Code for client creation.

  public static ZeebeClient getZeebeClientForDev() {
    URI grpcURI = null;
    try {
      grpcURI = new URI("http://localhost:26500");
    } catch (URISyntaxException e) {
      throw new RuntimeException(e);
    }
    return ZeebeClient.newClientBuilder().grpcAddress(grpcURI).usePlaintext().build();
  }
public static void main(String[] args) {
    try (ZeebeClient client = ZeebeClientFactory.getZeebeClientForDev()) {
      DeployResourceCommandStep1.DeployResourceCommandStep2 deployResourceCommand = client.newDeployResourceCommand()
              .addResourceFromClasspath("send-email.bpmn")
              .tenantId("rakesh");
      ZeebeFuture<DeploymentEvent> deploymentEvent = deployResourceCommand.send();
      deploymentEvent.join();

      final ProcessInstanceEvent event = client.newCreateInstanceCommand()
              .bpmnProcessId("send-email")
              .latestVersion()
              .variables(Map.of("message_content", "Hello from the Java get started"))
              .send()
              .join();

      LOG.info(
              "Started instance for processDefinitionKey='{}', bpmnProcessId='{}', version='{}' with processInstanceKey='{}'",
              event.getProcessDefinitionKey(), event.getBpmnProcessId(), event.getVersion(),
              event.getProcessInstanceKey());
    }
  }

The above code is used from the camunda official example link, but modified to support tenant, instead of tenant.

Got the following exception:

Exception in thread "main" io.camunda.zeebe.client.api.command.ClientStatusException: Expected bearer token at header with key [authorization], but found nothing
	at io.camunda.zeebe.client.impl.ZeebeClientFutureImpl.transformExecutionException(ZeebeClientFutureImpl.java:116)
	at io.camunda.zeebe.client.impl.ZeebeClientFutureImpl.join(ZeebeClientFutureImpl.java:54)
	at io.camunda.getstarted.DeployAndStartInstance.main(DeployAndStartInstance.java:43)
Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Expected bearer token at header with key [authorization], but found nothing
	at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:395)
	at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1999)
	at io.camunda.zeebe.client.impl.ZeebeClientFutureImpl.join(ZeebeClientFutureImpl.java:52)
	... 1 more
Caused by: io.grpc.StatusRuntimeException: UNAUTHENTICATED: Expected bearer token at header with key [authorization], but found nothing
	at io.grpc.Status.asRuntimeException(Status.java:533)
	at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:481)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.