ruflin / Elastica

Elastica is a PHP client for elasticsearch
http://elastica.io/
MIT License
2.26k stars 736 forks source link

Token based authentication #2146

Open johnbburg opened 1 year ago

johnbburg commented 1 year ago

I'm not sure if I'm missing something, the default authentication method is username/password. Which uses basic auth within the URL. I don't see how I can use token based authentication here. e.g.

Authorization: Bearer private-XXXXXXXXXXXXXXX

I'm trying to use an Elastic cloud engine for searches, and these appear to require requests be authenticated with a bearer token in the header, and I just don't see how I can use this method. Am I missing something? Would that be the digest option?

ruflin commented 1 year ago

Elastic cloud engine

What do you mean by this exactly? I know there is API key authentication but where did you see the Bearer token?

I have not tested this, but I would assume you could add the Bearer token as header to the client and it should work: https://github.com/ruflin/Elastica/blob/8.x/src/Client.php#L168

johnbburg commented 1 year ago

Thank you for the response.

I think they actually call it an App search engine, and yes, I mean a key. That's a good thought, on using the headers, I will look into that. Although yesterday I switched to looking into their reach apps. But this approach may allow us to do what we need.