diff --git a/index.js b/index.js index c01e9e2..a1b4874 100644 --- a/index.js +++ b/index.js @@ -252,9 +252,10 @@ async function authentificate(){ }) if(this.options.verbose) console.info("Got challenge:", challenge?.result?.challenge || challenge?.msg || challenge) if(!challenge.success) return challenge + if(!challenge?.result?.challenge) return { success: false, msg: `No challenge was given for an unknown reason: ${challenge?.msg || challenge?.message || challenge?.result?.msg || challenge?.result?.message || challenge?.status_code}`, challenge } // Déterminer le mot de passe - var password = createHmac("sha1", this.options.appToken).update(challenge.result.challenge).digest("hex") + var password = createHmac("sha1", this.options.appToken).update(challenge?.result?.challenge).digest("hex") if(this.options.verbose) console.info("Password for challenge:", password) // On s'authentifie diff --git a/package.json b/package.json index f7f45b8..2750ba3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "freebox-wrapper", - "version": "1.0.2", + "version": "1.0.3", "description": "Un wrapper pour l'API de Freebox OS, gère la connexion et facilite les requêtes.", "main": "index.js", "keywords": [