Skip to content

Commit 0391fa0

Browse files
authored
revert: add new api for send a refresh-token (#1216) (#1232)
1 parent 0b935a9 commit 0391fa0

File tree

3 files changed

+0
-23
lines changed

3 files changed

+0
-23
lines changed

src/client.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,10 +1237,6 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
12371237
event,
12381238
});
12391239

1240-
if (event.type === 'token.expiring' && !this.tokenManager.isStatic()) {
1241-
this.refreshToken();
1242-
}
1243-
12441240
if (event.type === 'user.presence.changed' || event.type === 'user.updated' || event.type === 'user.deleted') {
12451241
this._handleUserEvent(event);
12461242
}
@@ -3371,15 +3367,4 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
33713367
async commitMessage(id: string) {
33723368
return await this.post<APIResponse & MessageResponse>(this.baseURL + `/messages/${id}/commit`);
33733369
}
3374-
3375-
/**
3376-
* Calls the token provider to retrieve a new token
3377-
*
3378-
* This is an internal method, you only need to use it if, for some reason, the existing refresh logic of the client doesn't suit your needs.
3379-
*
3380-
*/
3381-
async refreshToken() {
3382-
const token = await this.tokenManager.loadToken();
3383-
return this.wsConnection?.refreshToken(token);
3384-
}
33853370
}

src/connection.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,4 @@ export class StableWSConnection<StreamChatGenerics extends ExtendableGenerics =
622622
}
623623
}, this.connectionCheckTimeout);
624624
};
625-
626-
refreshToken = (token: string) => {
627-
// you can expect `token.ack` event if backend registered the new token for the WS connection
628-
const d = JSON.stringify({ type: 'token.refresh', api_key: this.client.key, token });
629-
this.ws?.send(d);
630-
};
631625
}

src/events.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ export const EVENT_MAP = {
4242
'user.updated': true,
4343
'user.watching.start': true,
4444
'user.watching.stop': true,
45-
'token.expiring': true,
46-
'token.ack': true,
4745

4846
// local events
4947
'channels.queried': true,

0 commit comments

Comments
 (0)