diff --git a/package.json b/package.json index d5cece5..b6e2fb6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@timcrider/aquasec-client", - "version": "0.2.3", + "version": "0.2.4", "engines": { "node": ">=18.0.0" }, diff --git a/src/aqua-client.js b/src/aqua-client.js index f9de198..f2dfcd3 100644 --- a/src/aqua-client.js +++ b/src/aqua-client.js @@ -340,6 +340,10 @@ class AquaClient { return new Promise (async (resolve, reject) => { try { let token = await this.fetchToken(credentials); + if (token.code !== 200 || !token.token) { + throw new Error(`Authentication failed: ${token.message}`); + } + this.setToken(token.token); // @todo check options to reutrn token or true