Home > Blockchain >  Basic Authentication for Kafka Connect to Access Schema Registry
Basic Authentication for Kafka Connect to Access Schema Registry

Time:12-03

We have set our Schema Registry and Kafka Connect to use basic authentication. Some of the connectors can pull schemas from the registry without any problem. 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.

CodePudding user response:

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

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