cauthy-auth 0.38.1 → 0.38.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -715,9 +715,10 @@ function createSystem(given = {}) {
715
715
  let asking;
716
716
  async function ask() {
717
717
  configured();
718
- const form = new URLSearchParams({ grant_type: "client_credentials", client_id: clientId });
718
+ const self = key?.clientId || clientId;
719
+ const form = new URLSearchParams({ grant_type: "client_credentials", client_id: self });
719
720
  if (key) {
720
- const assertion = await new SignJWT({}).setProtectedHeader({ alg: "RS256", kid: key.keyId }).setIssuer(clientId).setSubject(clientId).setAudience(tokenEndpoint).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("2m").sign(await signingKey());
721
+ const assertion = await new SignJWT({}).setProtectedHeader({ alg: "RS256", kid: key.keyId }).setIssuer(self).setSubject(self).setAudience(tokenEndpoint).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("2m").sign(await signingKey());
721
722
  form.set("client_assertion_type", ASSERTION_TYPE);
722
723
  form.set("client_assertion", assertion);
723
724
  } else {