oauthbearer authentication example using Red Hat OpenShift Streams for Apache Kafka and KafkaJS
-
Go to Get started with Red Hat OpenShift Streams for Apache Kafka
-
Create kafka instance
-
Create a topic called test-topic (or change the topic name in the source code)
-
Save each required the information for the following constants:
const CLIENT_ID = '';
const CLIENT_SECRET = '';
const TOKEN_ENDPOINT_URL = '';
const BOOTSTRAP_SERVER = '';
- Run the code
npm i
node main.js
logLevel: logLevel.DEBUG
...
{"level":"DEBUG","timestamp":"2021-06-18T00:53:55.991Z","logger":"kafkajs","message":"[SASLOAuthBearerAuthenticator] SASL OAUTHBEARER authentication successful",
...