From 80c6a4dc4b76666c3410c17674d49669f1c734b4 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Sun, 12 Jan 2025 13:05:09 +0100 Subject: [PATCH] client: pass all arguments to credentials function --- packages/client/lib/createOnAuthenticate.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/client/lib/createOnAuthenticate.js b/packages/client/lib/createOnAuthenticate.js index 8d8c4ea1..e795c150 100644 --- a/packages/client/lib/createOnAuthenticate.js +++ b/packages/client/lib/createOnAuthenticate.js @@ -2,12 +2,14 @@ const ANONYMOUS = "ANONYMOUS"; const PLAIN = "PLAIN"; export default function createOnAuthenticate(credentials, userAgent) { - return async function onAuthenticate(authenticate, mechanisms, fast, entity) { + return async function onAuthenticate(...args) { if (typeof credentials === "function") { - await credentials(authenticate, mechanisms, fast); + await credentials(...args); return; } + const [authenticate, mechanisms, fast, entity] = args; + credentials.token ??= await fast?.fetch(); const mechanism = getMechanism({ mechanisms, entity, credentials });