Identify: hold onto access token

This commit is contained in:
Rory&
2026-01-30 21:26:57 +01:00
parent 1d5e31bdd5
commit 04ab638ed8
2 changed files with 4 additions and 1 deletions

View File

@@ -96,6 +96,8 @@ export async function onIdentify(this: WebSocket, data: Payload) {
}),
);
this.accessToken = identify.token;
taskSw.reset(); // don't include checkToken time...
const user = tokenData.user;
@@ -634,7 +636,7 @@ export async function onIdentify(this: WebSocket, data: Payload) {
});
if (this.capabilities.has(Capabilities.FLAGS.AUTH_TOKEN_REFRESH) && tokenData.tokenVersion != CurrentTokenFormatVersion) {
d.auth_token = await generateToken(this.user_id);
d.auth_token = this.accessToken = (await generateToken(this.user_id))!;
}
// const buildReadyEventDataTime = taskSw.getElapsedAndReset();

View File

@@ -27,6 +27,7 @@ export interface WebSocket extends WS {
version: number;
user_id: string;
session_id: string;
accessToken: string;
encoding: "etf" | "json";
compress?: "zlib-stream" | "zstd-stream";
ipAddress?: string;