algolia / algolia/algoliasearch-client-javascript
Ability to set callback that return fresh API Key
- Lingua principale
- TypeScript
- Stelle
- 1.4k
- Fork
- 226
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**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
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Non viene indicato alcun file sorgente né alcun test. Inizia tracciando la creazione di searchclient e l’uso della chiave API, quindi esamina come InstantSearch osserva le modifiche al client e mantiene la propria cache delle query. Il lavoro è completato quando c’è accordo sui tempi del callback e sul comportamento di aggiornamento, senza sostituire il client né duplicare le query.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- api
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100