algolia / algolia/algoliasearch-client-javascript

Ability to set callback that return fresh API Key

Ouverte
#1,307 6 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
1.4k
Forks
227
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

**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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Aucun fichier source ni test n’est nommé. Commencez par suivre la création de searchclient et l’utilisation de la clé API, puis examinez comment InstantSearch observe les changements du client et maintient son cache de requêtes. C’est terminé lorsque le moment d’exécution du callback et le comportement d’actualisation font l’objet d’un accord, sans remplacer le client ni dupliquer les requêtes.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, typescript
Domaine
api
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.