Elastica icon indicating copy to clipboard operation
Elastica copied to clipboard

Token based authentication

Open johnbburg opened this issue 1 year ago • 2 comments

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?

johnbburg avatar Feb 23 '23 17:02 johnbburg

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

ruflin avatar Feb 24 '23 08:02 ruflin

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.

johnbburg avatar Feb 24 '23 14:02 johnbburg