Skip to content

Commit

Permalink
Some fixes for auth key handling.
Browse files Browse the repository at this point in the history
Added new UID field.
  • Loading branch information
mrinc committed Apr 4, 2024
1 parent 479d207 commit 4057921
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export type NewAPIApplicationBase<Meta extends object> = {
};
export type NewAPIApplicationBaseApplication = {
idapplication: number;
uid: string;
debitorder: boolean;
};
export type NewAPIApplicationBaseBank = {
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/service-iq-enterprise/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ export class Plugin<Meta extends object = any> extends BSBService<
password: string,
cleanup: boolean = false
): Promise<Axios> {
const now = new Date().getTime() - 30 * 1000;
const now = new Date().getTime();
if (cleanup) {
for (let i = 0; i < this._axios.length; i++) {
if (this._axios[i].hostname !== hostname) continue;
Expand Down Expand Up @@ -692,7 +692,7 @@ export class Plugin<Meta extends object = any> extends BSBService<
async function (error) {
const { config } = error;

if (!config || config.retry === true) return Promise.reject(error);
if (!config || config.retry === true || !error.response) return Promise.reject(error);

if (error.response.status !== 401 && error.response.status !== 403)
return Promise.reject(error);
Expand All @@ -705,7 +705,7 @@ export class Plugin<Meta extends object = any> extends BSBService<
for (let i = 0; i < self._axios.length; i++) {
if (self._axios[i].hostname !== hostname) continue;
if (self._axios[i].username !== username) continue;
self._axios[i].exp = new Date().getTime() + 5 * 60 * 1000;
self._axios[i].exp = new Date().getTime() + 4 * 60 * 1000;
break;
}

Expand All @@ -721,7 +721,7 @@ export class Plugin<Meta extends object = any> extends BSBService<
hostname,
username,
instance,
exp: new Date().getTime() + 5 * 60 * 1000,
exp: new Date().getTime() + 4 * 60 * 1000,
});
return instance;
}
Expand Down

0 comments on commit 4057921

Please sign in to comment.