summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-01-30 21:26:57 +0100
committerRory& <root@rory.gay>2026-01-30 21:29:01 +0100
commit04ab638ed897d277b375f0fe66c90c2c4e1685ad (patch)
tree45185243b8f38a15efe88f5365d8b1f7150c5d13
parentBasic offload configuration (diff)
downloadserver-ts-04ab638ed897d277b375f0fe66c90c2c4e1685ad.tar.xz
Identify: hold onto access token
-rw-r--r--src/gateway/opcodes/Identify.ts4
-rw-r--r--src/gateway/util/WebSocket.ts1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts

index e9b91a3d..77421765 100644 --- a/src/gateway/opcodes/Identify.ts +++ b/src/gateway/opcodes/Identify.ts
@@ -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(); diff --git a/src/gateway/util/WebSocket.ts b/src/gateway/util/WebSocket.ts
index af085421..301b0515 100644 --- a/src/gateway/util/WebSocket.ts +++ b/src/gateway/util/WebSocket.ts
@@ -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;