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
2 changes: 1 addition & 1 deletion 2 packages/authentication-client/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class AuthenticationClient {
if (!authPromise || force === true) {
authPromise = this.getAccessToken().then((accessToken) => {
if (!accessToken) {
throw new NotAuthenticated('No accessToken found in storage')
return this.handleError(new NotAuthenticated('No accessToken found in storage'), 'authenticate')
}

return this.authenticate({
Expand Down
3 changes: 2 additions & 1 deletion 3 packages/authentication-client/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,11 @@ describe('@feathersjs/authentication-client', () => {
})

describe('reauthenticate', () => {
it('fails when no token in storage', async () => {
it('fails when no token in storage and resets authentication state', async () => {
await assert.rejects(() => app.authentication.reAuthenticate(), {
message: 'No accessToken found in storage'
})
assert.ok(!app.get('authentication'), 'Reset authentication')
})

it('reauthenticates when token is in storage', async () => {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.