Skip to content

Commit

Permalink
Merge pull request #753 from wazo-platform/more_defensive
Browse files Browse the repository at this point in the history
Add some auth error log and be more defensive
  • Loading branch information
bogue authored Feb 28, 2024
2 parents a3e16d8 + 4fc2ad7 commit a6cdb83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/simple/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ class Auth {
this.checkSubscription(session, +this.minSubscriptionType);
}
} catch (e: any) {
logger.error('on authenticated error', e);

// Destroy tokens when validation fails
if (this.clientId) {
await getApiClient().auth.deleteRefreshToken(this.clientId);
Expand Down
4 changes: 3 additions & 1 deletion src/web-rtc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2602,7 +2602,9 @@ export default class WebRTCClient extends Emitter {

if (this.sessionNetworkStats[sessionId]) {
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
this.sessionNetworkStats[sessionId].push(networkStats);
if (sessionId in this.sessionNetworkStats) {
this.sessionNetworkStats[sessionId].push(networkStats);
}
}
}

Expand Down

0 comments on commit a6cdb83

Please sign in to comment.