Skip to content

Commit

Permalink
Fixing bug when authentication fails and a token is not returned. @Ve…
Browse files Browse the repository at this point in the history
…rsion 0.2.4
  • Loading branch information
timcrider committed May 8, 2023
1 parent 2ce3f5a commit 7c7b565
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@timcrider/aquasec-client",
"version": "0.2.3",
"version": "0.2.4",
"engines": {
"node": ">=18.0.0"
},
Expand Down
4 changes: 4 additions & 0 deletions src/aqua-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7c7b565

Please sign in to comment.