From 0d2064382644381150e5c2fff89e2af0edef4868 Mon Sep 17 00:00:00 2001 From: "Peter Cooper Jr." Date: Thu, 6 Jun 2024 08:31:50 -0400 Subject: [PATCH] Handle case where the returned auth is already valid At least for Buypass, if one already has previously validated an authorization on that ACME account for a requested domain name, the initial status when created is "valid". However, the code was trying to submit the challenge for validation anyway, causing the server to return "status:400 Unable to process challenge, authorization is not pending". So, if the initial status is valid, it should just proceed rather than trying to process the challenge again. I'm not sure if this is exactly the best way to write this, but it seems to work for me on both Let's Encrypt and Buypass. --- acme.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/acme.js b/acme.js index 1c35d4c..f708678 100644 --- a/acme.js +++ b/acme.js @@ -855,7 +855,11 @@ ACME._postChallenge = function (me, options, kid, auth) { .catch(transformError); } - return respondToChallenge(); + if (auth.status === 'valid') { + return pollStatus(); + } else { + return respondToChallenge(); + } }; // options = { domains, claims, challenges }