Improve authentication handling (#908)
This commit is contained in:
committed by
GitHub
parent
24e674469e
commit
0ebbd71e9a
@ -50,6 +50,26 @@ const nodeOpts: NodeOptions = {
|
||||
|
||||
const client2 = new Client({ node: nodeOpts })
|
||||
|
||||
const clientBasicAuth = new Client({
|
||||
node: 'http://localhost:9200',
|
||||
auth: { username: 'foo', password: 'bar' }
|
||||
})
|
||||
|
||||
const clientApiKeyString = new Client({
|
||||
node: 'http://localhost:9200',
|
||||
auth: { apiKey: 'foobar' }
|
||||
})
|
||||
|
||||
const clientApiKeyObject = new Client({
|
||||
node: 'http://localhost:9200',
|
||||
auth: {
|
||||
apiKey: {
|
||||
id: 'foo',
|
||||
api_key: 'bar'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
client.on(events.RESPONSE, (err: errors.ElasticsearchClientError | null, request: RequestEvent) => {
|
||||
if (err) console.log(err)
|
||||
const { body, statusCode } = request
|
||||
|
||||
Reference in New Issue
Block a user