I am using rhea lib to connect to solace broker and publish/subscribe on broker topic/queues using Basic auth, however instead of basic auth I want to use OAuth2 for authentication purpose. I tried same but it didn't work. I get the Authentication error - 'ConnectionError: Failed to authenticate: 2'. As per solace document, they support AMQP with OAUTH - https://docs.solace.com/Security/Client-Authentication-Overview.htm#OAuth 'For AMQP clients, PubSub+ event brokers support the XOAUTH2 SASL authentication mechanism. In this case, the AMQP URL must be amqps://:?amqp.saslMechanisms=XOAUTH2.' however for rhea lib, adding saslMechanisms in hostname isn't supported. We have to give saslMechanisms in container options, and provide the token in 'password' field as per Solace doc. I did the same thing but it didn't work. Note: I already have enabled OAuth in my solace broker and currently using it with MQTT protocol.
const options: ContainerOptions = {
scheme: 'amqps',
host: 'localhost',
port: 5671,
username: 'devuser',
password: token.access_token,
id: 'testclient',
transport: 'tls',
ca: [fs.readFileSync(path.resolve(__dirname + "../..", 'certificate.pem'))],
sasl: {enabled:true},
container_id: "testcontId",
sasl_mechanism: ["XOAUTH2"]
}
this.container = create_container(options);
this.connection = this.container.connect(options);