Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 4 packages/authentication-client/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class AuthenticationClient {
return Promise.reject(error);
}

reAuthenticate (force: boolean = false): Promise<AuthenticationResult> {
reAuthenticate (force: boolean = false, strategy?: string): Promise<AuthenticationResult> {
// Either returns the authentication state or
// tries to re-authenticate with the stored JWT and strategy
const authPromise = this.app.get('authentication');
Expand All @@ -144,7 +144,7 @@ export class AuthenticationClient {
}

return this.authenticate({
strategy: this.options.jwtStrategy,
strategy: strategy || this.options.jwtStrategy,
accessToken
});
});
Expand Down
22 changes: 22 additions & 0 deletions 22 packages/authentication-client/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,27 @@ describe('@feathersjs/authentication-client', () => {
assert.ok(!app.get('authentication'));
});
});

it('reauthenticates using different strategy', async () => {
app.configure(client({ jwtStrategy: 'any' }));

const data = {
strategy: 'testing'
};

let result = await app.authenticate(data);
assert.deepStrictEqual(result, {
accessToken,
data,
user
});

result = await app.authentication.reAuthenticate(false, 'jwt');
assert.deepStrictEqual(result, {
accessToken,
data,
user
});
})
});
});
Morty Proxy This is a proxified and sanitized view of the page, visit original site.