Skip to content

Commit ff3e104

Browse files
authored
fix(authentication-client): Allow to abort fetch (#3310)
1 parent 0cbdb03 commit ff3e104

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

docs/api/client/rest.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ const controller = new AbortController()
132132

133133
app.configure(restClient.fetch(fetch))
134134

135-
const promise = app.service('messages').get(1, {
135+
app.service('messages').get(1, {
136136
connection: {
137137
signal: controller.signal
138138
}
139139
})
140140

141-
promise.abort()
141+
controller.abort()
142142
```
143143

144144
#### Superagent

packages/authentication-client/src/core.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,10 @@ export class AuthenticationClient {
166166
*
167167
* @param force force reauthentication with the server
168168
* @param strategy The name of the strategy to use. Defaults to `options.jwtStrategy`
169+
* @param authParams Additional authentication parameters
169170
* @returns The reauthentication result
170171
*/
171-
reAuthenticate(force = false, strategy?: string): Promise<AuthenticationResult> {
172+
reAuthenticate(force = false, strategy?: string, authParams?: Params): Promise<AuthenticationResult> {
172173
// Either returns the authentication state or
173174
// tries to re-authenticate with the stored JWT and strategy
174175
let authPromise = this.app.get('authentication')
@@ -179,10 +180,13 @@ export class AuthenticationClient {
179180
return this.handleError(new NotAuthenticated('No accessToken found in storage'), 'authenticate')
180181
}
181182

182-
return this.authenticate({
183-
strategy: strategy || this.options.jwtStrategy,
184-
accessToken
185-
})
183+
return this.authenticate(
184+
{
185+
strategy: strategy || this.options.jwtStrategy,
186+
accessToken
187+
},
188+
authParams
189+
)
186190
})
187191
this.app.set('authentication', authPromise)
188192
}

0 commit comments

Comments
 (0)