By default, the keys used to configure the Magento extension are the "Admin API key" and the "Search API key". As a first step you need to make sure that these settings are using a key value that is valid and has not expired. From your Algolia Dashboard, you can access your admin API key and search API key to ensure that they are correctly entered in the Magento admin page.
The validUntil
parameter refers to the validity of a Secured API key. Please note that as mentioned here, that Secured API Keys do not appear in the Algolia Dashboard, or on the Algolia logs, as they run on your own server.
Using the method getSecuredApiKeyRemainingValidity
, you can retrieve the remaining validity of a secured API key in seconds. You can add custom logic on your frontend that will check the validity of a key and automatically generate a new one, if the previous one has expired.
By default, the Magento extension generates a secured api key whenever the page is built, and it remains in cache during the cache lifetime of the page. The extension creates those keys, by default, using this method https://github.com/algolia/algoliasearch-magento-2/blob/505d2e213141ca6d0c50a1768956dfc02496af00/Helper/AlgoliaHelper.php#L318
The validUntil
parameter is calculated by the current time + the ALGOLIA_API_SECURED_KEY_TIMEOUT_SECONDS
parameter, which is equal to 86400 by default. If this time is not enough for your needs or any third-party settings applied on your site, you can override it here https://github.com/algolia/algoliasearch-magento-2/blob/505d2e213141ca6d0c50a1768956dfc02496af00/Helper/AlgoliaHelper.php#L39