This commit is contained in:
Benjamin Toby
2025-03-12 07:22:04 +01:00
parent c192d9cd13
commit ec4d0428bb
7 changed files with 98 additions and 13 deletions
+6 -1
View File
@@ -35,6 +35,7 @@ type Param = {
skipWriteAuthFile?: boolean;
apiUserID?: string | number;
dbUserId?: string | number;
cleanupTokens?: boolean;
};
/**
@@ -58,6 +59,7 @@ export default async function loginUser({
skipWriteAuthFile,
dbUserId,
debug,
cleanupTokens,
}: Param): Promise<APILoginFunctionReturn> {
const grabedHostNames = grabHostNames({ userId: user_id || apiUserID });
const { host, port, scheme } = grabedHostNames;
@@ -244,7 +246,10 @@ export default async function loginUser({
if (httpResponse.csrf && !skipWriteAuthFile) {
writeAuthFile(
httpResponse.csrf,
JSON.stringify(httpResponse.payload)
JSON.stringify(httpResponse.payload),
cleanupTokens && httpResponse.payload?.id
? { userId: httpResponse.payload.id }
: undefined
);
}