Skip to content

Add parameter to use a secured API key instead of the global api key in the config #207

Open
@Splinteer

Description

@Splinteer

Is your feature request related to a problem? Please describe.

I have user restricted data in my indexes but the only way to access it is using a secured API key.
But actually the searchClient is created via useAlgoliaRef() that use the global search key.

Describe the solution you'd like

I need a way to pass the apiKey to the useAlgoliaRef() composable

Activity

Baroshem

Baroshem commented on Sep 9, 2024

@Baroshem
Collaborator

Hey there,

What about passing index as a parameter for useAlgoliaSearch composable? https://algolia.nuxtjs.org/getting-started/usage#usealgoliasearch

The one passed in the composable should be applied before the global one

Splinteer

Splinteer commented on Sep 9, 2024

@Splinteer
Author

Because the index doesn't change, and if you want user restricted data you must use a different api key.
Cf: https://www.algolia.com/doc/guides/security/api-keys/how-to/user-restricted-access-to-data

Baroshem

Baroshem commented on Sep 19, 2024

@Baroshem
Collaborator

Ahh I see, makes sense.

Would you be interested in contributing to the module with this change? I can provide the help if needed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

      Participants

      @Splinteer@Baroshem

      Issue actions

        Add parameter to use a secured API key instead of the global api key in the config · Issue #207 · nuxt-modules/algolia