Skip to content

Commit

Permalink
client: pass all arguments to credentials function
Browse files Browse the repository at this point in the history
  • Loading branch information
sonnyp committed Jan 12, 2025
1 parent ff263d7 commit 80c6a4d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/client/lib/createOnAuthenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down

0 comments on commit 80c6a4d

Please sign in to comment.