mirror of
https://github.com/spacebarchat/server.git
synced 2026-03-30 13:55:39 +00:00
Identify: hold onto access token
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user