Skip to content

Commit

Permalink
throw an exception if credentials are incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcottle committed Jun 29, 2022
1 parent 763260c commit 1d50cd8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ class API {
}
);

// throw exception for auth_failure
if(access_tokens.data?.error === 'auth_failure'){
throw new Error("auth_failure: username or password is incorrect.");
}

// update access token
var tokens = parseTokensFromUrl(access_tokens.data.response.parameters.uri);
this.access_token = tokens.access_token;
Expand Down

0 comments on commit 1d50cd8

Please sign in to comment.