Skip to content

Commit 91b4d52

Browse files
committed
minnor changes
1 parent bd6e331 commit 91b4d52

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

packages/auth/src/core/auth/auth_impl.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,7 @@ describe('core/auth/auth_impl', () => {
367367
const token = await auth.getFirebaseAccessToken();
368368
expect(token).to.be.null;
369369
expect(exchangeTokenStub).not.to.have.been.called;
370-
expect(persistenceStub._remove).to.have.been.calledWith(
371-
'firebase:persistence-token:api-key:test-app'
372-
);
370+
expect(persistenceStub._remove).to.have.been.called;
373371
});
374372

375373
it('should refresh the token if token is expiring in next 1 minute and a token refresh handler is set', async () => {
@@ -445,9 +443,7 @@ describe('core/auth/auth_impl', () => {
445443
'Token refresh failed:',
446444
sinon.match.instanceOf(Error)
447445
);
448-
expect(persistenceStub._remove).to.have.been.calledWith(
449-
'firebase:persistence-token:api-key:test-app'
450-
);
446+
expect(persistenceStub._remove).to.have.been.called;
451447
});
452448

453449
it('should return null and log an error if the refreshed token is invalid', async () => {

packages/auth/src/core/auth/auth_impl.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ export class AuthImpl implements AuthInternal, _FirebaseService {
266266
return firebaseAccessToken.token;
267267
}
268268

269-
// Signs out the user i.e. sets the firebaseToken to null.
270-
await this.signOut();
271269
if (firebaseAccessToken && this.tokenRefreshHandler) {
272270
try {
273271
// Awaits for the callback method to execute. The callback method
@@ -282,9 +280,10 @@ export class AuthImpl implements AuthInternal, _FirebaseService {
282280
return this.getFirebaseAccessToken(false);
283281
} catch (error) {
284282
console.error('Token refresh failed:', error);
285-
return null;
286283
}
287284
}
285+
// Signs out the user i.e. sets the firebaseToken to null if firebase token is not valid and refresh token handler is not set/ successful.
286+
await this.signOut();
288287
return null;
289288
}
290289

0 commit comments

Comments
 (0)