algolia / algolia/algoliasearch-client-javascript

Ability to set callback that return fresh API Key

オープン
#1,307 コメント 6 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
1.4k
フォーク
226
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

ソースファイルもテストも指定されていません。まず searchclient の作成と API キーの使用を追跡し、次に InstantSearch がクライアントの変更を監視し、クエリキャッシュを維持する方法を調べてください。クライアントを置き換えたりクエリを重複させたりせずに、callback のタイミングと更新動作について合意できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript
領域
api
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。