appbaseio / appbase-js

appbase.io search client library for JavaScript
MIT License
42 stars 18 forks source link

Can't pass credentials via Authorization header #47

Closed lakhansamani closed 5 years ago

lakhansamani commented 5 years ago

If it is Appbase app and credentials are passed as Authorization header instead of credentials in the config, then it doesn't allow the user to connect.

An error is thrown from the following line https://github.com/appbaseio/appbase-js/blob/develop/src/core/index.js#L51

metagrover commented 5 years ago

I think this is an expected behavior. We can implement this enhancement if you have a use-case to support it.

lakhansamani commented 5 years ago

Since we are using appbase-js in ReactiveSearch, if someone passes headers props with Authorization instead of credentials then it could fail and crash the whole app.

metagrover commented 5 years ago

It will only crash in case of scalr.api.appbase.io. In such cases, you should use credentials prop. Do you have a usecase where you can't use credentials prop with scalr api url as the url prop in ReactiveBase?

siddharthlatest commented 5 years ago

@metagrover That's a good point. One use-case is users who want to use Basic Auth headers instead to authenticate. Overall, I think we should leave it mandatory for scalr.api.appbase.io host, but not for a generic ES cluster. If this is already the case, we can close this issue.

metagrover commented 5 years ago

Yep, that's the current state of things.