algolia / algolia/algoliasearch-client-javascript

Ability to set callback that return fresh API Key

Abierto
#1,307 6 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
1.4k
Forks
226
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

**Context :**
Following the issue #772, we can now check remaining validity of API Key.

**Problem :**
In our application, we are generating very short term API Keys (5 minutes) to always be compliant with filters and visibility that are set in the Key (from our backend according to user access rights).

It could be very cool to add a callback while creating the `searchclient` which will be called when API Key is near expiration and which should return a fresh API Key.

**Workaround :**
Currently, we are wrapping the search methods from `searchclient` into some of our wrappers that do the check before every request.
If we detect that API Key is expired, we generate a new `searchclient` with the updated API Key and use it to execute the query.
However there is two bad concerns about this workaround :

1. As searchclient instance change, the `InstantSearch` node seems to detect it and relaunch a new query (which is now duplicated).
2. As searchclient instance change, what happen to the currently built query cache ? Reset ?

Yours faithfully,
LCDP

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

No se nombra ningún archivo fuente ni ninguna prueba. Empieza rastreando la creación de searchclient y el uso de la clave de API, y después inspecciona cómo InstantSearch observa los cambios del cliente y mantiene su caché de consultas. Se considera terminado cuando haya acuerdo sobre el momento de ejecución del callback y el comportamiento de actualización, sin reemplazar el cliente ni duplicar consultas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, typescript
Área
api
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.