How to use secured_api_key in client?

I’m following these instructions:

on how to create a secured_api_key :

secured_api_key = Algolia.generate_secured_api_key(
  'your_search_only_api_key_kept_private', # Make sure to use a search key
  { filters: 'viewable_by:' + current_user_id.to_s }

Where and how do I use this secured_api_key (generated in Ruby) in Javascript to have results pre-filtered? I’m using the React Autocomplete widget.

const searchClient = algoliasearch(
window.searchKey // my generated key

this is not working ^^

Hi @george,

Thanks for contacting Algolia. From your question it appears you are successfully generating your secured API key on the backend. Is that right?

You now need to determine in your application how to send it to the frontend:

We hope the two suggestions in the guide help.

I’ve figured it out.

attributesForFaceting [

    searchableAttributes [

Was putting it in the wrong section…
needed to be in attributesForFaceting