From 4698ec14523d70e55261a4886571493ccce4a501 Mon Sep 17 00:00:00 2001 From: Thomas Howlett <1786243+howlettt@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:04:31 -0600 Subject: [PATCH 1/2] Fix fetch abort example --- docs/api/client/rest.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api/client/rest.md b/docs/api/client/rest.md index 5a981eaf05..abba88c797 100644 --- a/docs/api/client/rest.md +++ b/docs/api/client/rest.md @@ -132,13 +132,13 @@ const controller = new AbortController() app.configure(restClient.fetch(fetch)) -const promise = app.service('messages').get(1, { +app.service('messages').get(1, { connection: { signal: controller.signal } }) -promise.abort() +controller.abort() ``` #### Superagent From 2bd2b5fd9aecb8d1e8c3bcff9891846ddc9e55b9 Mon Sep 17 00:00:00 2001 From: Thomas Howlett <1786243+howlettt@users.noreply.github.com> Date: Wed, 11 Oct 2023 21:18:46 -0600 Subject: [PATCH 2/2] Add authentication params to reAuthenticate --- packages/authentication-client/src/core.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/authentication-client/src/core.ts b/packages/authentication-client/src/core.ts index 01c99c0da1..cad7754e67 100644 --- a/packages/authentication-client/src/core.ts +++ b/packages/authentication-client/src/core.ts @@ -166,9 +166,10 @@ export class AuthenticationClient { * * @param force force reauthentication with the server * @param strategy The name of the strategy to use. Defaults to `options.jwtStrategy` + * @param authParams Additional authentication parameters * @returns The reauthentication result */ - reAuthenticate(force = false, strategy?: string): Promise { + reAuthenticate(force = false, strategy?: string, authParams?: Params): Promise { // Either returns the authentication state or // tries to re-authenticate with the stored JWT and strategy let authPromise = this.app.get('authentication') @@ -179,10 +180,13 @@ export class AuthenticationClient { return this.handleError(new NotAuthenticated('No accessToken found in storage'), 'authenticate') } - return this.authenticate({ - strategy: strategy || this.options.jwtStrategy, - accessToken - }) + return this.authenticate( + { + strategy: strategy || this.options.jwtStrategy, + accessToken + }, + authParams + ) }) this.app.set('authentication', authPromise) }