-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to use sendApiKeyAsQueryParam with instantsearch react? #187
Comments
By default Typesense sends API keys via an HTTP header, and if you set So when you set To send the API key in the post body, you want to do something like this: const generateTypesenseInstantsearchAdapterOptions = (): TypesenseInstantsearchAdapterOptions => {
// Search settings for full search
return {
server: {
apiKey: '',
nodes: [
{
host: ApiSettings.HOST,
port: ApiSettings.PORT,
protocol: ApiSettings.PROTOCOL,
},
],
},
additionalSearchParameters: {
'x-typesense-api-key': 'YOUR-LONG-API-KEY',
},
};
}; |
Thanks! making the api key as part additionalSearchParameters as advised, and now the api key gets sent as a query parameter. Is there a way to exclude the api key from the request url and make it part of the post body exclusively? I think if the url is too long (our api key is around 53kb currently) it might still get rejected by gateways like cloudflare. |
You want to set |
I see what you mean. Yeah it works as intended now. I decided to set sendApiKeyAsQueryParam: false instead as the url came out looking like https://typesense-server.com/multi_search?x-typesense-api-key= Thanks for the quick response! |
Description
Even though i set sendApiKeyAsQueryParam to false when i create a new TypesenseInstantSearchAdapterOptions react-instantsearch still sends queries with X-TYPESENSE-API-KEY http header.
How do i override react-instantsearch and make it post the api key under the payload body instead? I have a very long api key (> 2000 characters), and it's not going through some api gate ways as their request header limit is small.
Steps to reproduce
Expected Behavior
I expect react-instant search not to send X-TYPESENSE-API-KEY when a query is sent
Actual Behavior
react-instant search still sends api key with the header
Typesense Version: 0.23.1
OS: Ubuntu
The text was updated successfully, but these errors were encountered: