Authenticate with user:passowrd with elasticsearch node.js module

I can successfully connect to ES from Java and Curl, bu using 'myUserName:myPassword'
but when initializing the node.js client as shown in the doc, i receive 403

const { Client } = require('@elastic/elasticsearch')
const client = new Client({ node: 'https://myUserName:myPassword@myEsHostName:9200' })

{ ResponseError: security_exception
at IncomingMessage.response.on (d:\log_analyser\LogQualUI\node_modules@elastic\elasticsearch\lib\Transport.js:302:25)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
name: 'ResponseError',
{ body: { error: [Object], status: 403 },

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