Basic Authentication for Kafka Connect to Access Schema Registry

Viewed 716

We have set our Schema Registry and Kafka Connect to use basic authentication. Some of the connectors seem to be running. But some of them gives an error:

"io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: Unauthorized; error code: 401"

How can I give credentials of Schema Registry to Kafka Connect? Should I define it in connector config or connect-distributed.properties? Mind that I can use curl commands such as GET without any problems.

1 Answers

Oh solved it, gonna answer instead of deleting so if anyone faces the same problem they can quickly find the solution.

You just need to add a few lines to connect-distributed.properties (or -standalone).

schema.registry.basic.auth.user.info=user:pass
key.converter.basic.auth.user.info=user:pass    
value.converter.basic.auth.user.info=user:pass    
schema.registry.basic.auth.credentials.source=USER_INFO    
key.converter.basic.auth.credentials.source=USER_INFO   
value.converter.basic.auth.credentials.source=USER_INFO

Here user:pass is the login credentials for your schema registry.

I'm not sure if you have to add key and value converter lines, but did it to make sure and it's working this way. Also leave USER_INFO as it is and don't forget to restart the connect service.

Related