diff --git a/src/controllers/Auth.ts b/src/controllers/Auth.ts index 8aedf6c2..47581faf 100644 --- a/src/controllers/Auth.ts +++ b/src/controllers/Auth.ts @@ -437,7 +437,8 @@ export class AuthController extends BaseController { login( strategy: string, credentials: JSONObject, - expiresIn?: string | number + expiresIn?: string | number, + options: ArgsAuthControllerLogin = {} ): Promise { const request = { action: "login", @@ -448,7 +449,12 @@ export class AuthController extends BaseController { }; this.kuzzle.emit("beforeLogin"); - return this.query(request, { queuable: false, timeout: -1, verb: "POST" }) + return this.query(request, { + queuable: false, + timeout: -1, + verb: "POST", + ...options, + }) .then((response) => { if (this.kuzzle.cookieAuthentication) { if (response.result.jwt) { @@ -497,7 +503,7 @@ export class AuthController extends BaseController { * * @see https://docs.kuzzle.io/sdk/js/7/controllers/auth/logout */ - async logout(): Promise { + async logout(options: ArgsAuthControllerLogin = {}): Promise { this.kuzzle.emit("beforeLogout"); try { await this.query( @@ -505,7 +511,7 @@ export class AuthController extends BaseController { action: "logout", cookieAuth: this.kuzzle.cookieAuthentication, }, - { queuable: false, timeout: -1 } + { queuable: false, timeout: -1, ...options } ); this._authenticationToken = null; /** @@ -700,6 +706,10 @@ export type ArgsAuthControllerUpdateSelf = ArgsDefault; export type ArgsAuthControllerValidateMyCredentials = ArgsDefault; +export type ArgsAuthControllerLogin = ArgsDefault; + +export type ArgsAuthControllerLogout = ArgsDefault; + export interface ArgsAuthControllerRefreshToken extends ArgsDefault { expiresIn?: number | string; } diff --git a/src/controllers/Security.ts b/src/controllers/Security.ts index b2d63c8b..6a832337 100644 --- a/src/controllers/Security.ts +++ b/src/controllers/Security.ts @@ -515,11 +515,14 @@ export class SecurityController extends BaseController { ); } - refresh(collection) { - return this.query({ - action: "refresh", - collection, - }); + refresh(collection, options: ArgsSecurityControllerRefresh = {}) { + return this.query( + { + action: "refresh", + collection, + }, + options + ); } replaceUser(_id, body, options: ArgsSecurityControllerReplaceUser = {}) { @@ -809,3 +812,5 @@ export type ArgsSecurityControllerUpdateUser = ArgsDefault; export type ArgsSecurityControllerUpdateUserMapping = ArgsDefault; export type ArgsSecurityControllerValidateCredentials = ArgsDefault; + +export type ArgsSecurityControllerRefresh = ArgsDefault;