What should `onAuthorizer` return when authorization is denied?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
- Tipo di issue
- Documentazione
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- react-native, typescript
- Ambito
- authorization, mobile
Direzione di ricerca
Inizia dal contratto onAuthorizer nel listener init della classe Pusher e confrontalo con la documentazione collegata sulla risposta di autorizzazione di Pusher. Traccia come {}, undefined e l’autorizzazione negata vengono gestiti dal metodo nativo e da onError. Il lavoro è completato quando il comportamento documentato di restituzione e degli errori, inclusi i casi missing-auth e authorizer-timeout, è chiaro e coerente con il tipo TypeScript.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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?
- Lingua principale
- TypeScript
- Stelle
- 76
- Fork
- 64
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pusher/pusher-websocket-react-native
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 64/100
pusher/pusher-websocket-react-native#217 · 1 commento · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
-
feature-request
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
pusher/pusher-websocket-react-native#166 · 8 commenti · 11 reazioni ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 28/100
pusher/pusher-websocket-react-native#163 · 7 commenti ·
Tutte le issue di pusher/pusher-websocket-react-native
Issue simili
-
area:editor bug issue-form:bug P0 platform:windows review: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
1lck/Lithe-IDEA#1388 ·
I maintainer di solito rispondono entro 1 giorno
-
fix(api): isToolAuditEnabled swallows database read errors on auditToolOperations without loggingApertaarea: backend bug priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
snapotter-hq/SnapOtter#3238 ·
I maintainer di solito rispondono entro 1 giorno
-
rig up --plan times out after 5 s and reports an UNKNOWN outcome while the daemon completes the planAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
filesystem: search_files does not expand non-wildcard excludePatterns like directory_tree doesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
modelcontextprotocol/servers#5216 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno