What should `onAuthorizer` return when authorization is denied?
メンテナーはふだん 9 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- ドキュメント
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- react-native, typescript
- 領域
- authorization, mobile
調査の方向性
PusherクラスのinitリスナーにあるonAuthorizerの契約から始め、リンクされているPusher認証レスポンスのドキュメントと比較してください。{}, undefined、認証拒否がネイティブメソッドとonErrorによってどのように処理されるかを追跡してください。missing-authおよびauthorizer-timeoutのケースを含む、ドキュメント化された戻り値とエラーの動作が明確で、TypeScriptの型と一貫していれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I can't find a clear answer to this question in the documentation. In the Pusher authorization docs it says:
Unsuccessful responses from an authorization endpoint should serve a 403 Forbidden HTTP status.
Moreover, return type of onAuthorizer is Promise<PusherAuthorizerResult> which is defined as
export interface PusherAuthorizerResult {
auth?: string;
shared_secret?: string;
channel_data?: string;
}
Together this makes me think that onAuthorizer should return {} when the server responds with HTTP 403. But if I do that, then I get the following error: Client error | Invalid key in subscription auth data: '<missing_auth_param>' since the auth field is missing.
If I instead look at the usage of onAuthorizer in the Pusher class, I see this in Pusher#init:
this.addListener(
PusherEventName.ON_AUTHORIZER,
async ({ channelName, socketId }) => {
const data = await args.onAuthorizer?.(channelName, socketId);
if (data) {
await PusherWebsocketReactNative.onAuthorizer(
channelName,
socketId,
data
);
}
}
);
Here we check if the result of onAuthorizer is truthy before calling the native method. So from this I think that onAuthorizer should return a falsey value if authorization fails. But that (1) wouldn't typecheck and (2) if I return undefined then I instead get Client Error | Invalid key in subscription auth data: '<authorizer_timeout>'
So I'm at a bit of a loss as to how to implement this correctly. Should I just be handling the client errors with the onError method? Any pointers here, am I overlooking something?
- 主要言語
- TypeScript
- スター
- 76
- フォーク
- 65
- 平均マージ
- 9日 2時間
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pusher/pusher-websocket-react-native のほかの issue
-
Include custom host support in next release and fix Android Gradle build issues対応中かも @Keith-wright が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 64/100
pusher/pusher-websocket-react-native#217 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 9 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
pusher/pusher-websocket-react-native#178 ·
メンテナーはふだん 9 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
pusher/pusher-websocket-react-native#173 ·
メンテナーはふだん 9 日以内に返信
-
feature-request
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
pusher/pusher-websocket-react-native#166 · コメント 8 件 · リアクション 11 件 ·
メンテナーはふだん 9 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 28/100
pusher/pusher-websocket-react-native#163 · コメント 7 件 ·
メンテナーはふだん 9 日以内に返信
pusher/pusher-websocket-react-native の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
MoonshotAI/kimi-code#4398 ·
メンテナーはふだん 1 日以内に返信
-
Xiaomi Mimo语音识别服务异常オープンpending triage
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
package-lock.json : les binaires natifs macOS et Linux de unrs-resolver ont disparu depuis #1823オープンbug dependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
AxaFrance/design-system#2064 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100