Skip to content

Commit 3ef1f83

Browse files
committed
fix client
1 parent 9e74154 commit 3ef1f83

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

lib/client.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ class Client {
250250
if (cookies && cookies.length > 0) {
251251
for (const cookie of cookies) {
252252
if (cookie.startsWith("a_session_console=")) {
253-
globalConfig.setCookie(cookie);
253+
// Extract only the name=value portion, removing Set-Cookie attributes
254+
// Set-Cookie format: "name=value; expires=...; domain=...; etc"
255+
// Cookie header should only contain: "name=value"
256+
const cookieValue = cookie.split(";")[0].trim();
257+
globalConfig.setCookie(cookieValue);
254258
}
255259
}
256260
}

lib/sdks.ts

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,21 @@ export const sdkForConsole = async (
1616
);
1717
}
1818

19-
client
20-
.setEndpoint(endpoint)
21-
.setCookie(cookie)
22-
.setProject("console")
23-
.setSelfSigned(selfSigned)
24-
.setLocale("en-US");
25-
2619
client.headers = {
27-
"content-type": "",
2820
"x-sdk-name": "Command Line",
2921
"x-sdk-platform": "console",
3022
"x-sdk-language": "cli",
3123
"x-sdk-version": "13.0.0-rc.2",
3224
"user-agent": `AppwriteCLI/13.0.0-rc.2 (${os.type()} ${os.version()}; ${os.arch()})`,
33-
"X-Appwrite-Response-Format": "1.8.0",
3425
};
3526

27+
client
28+
.setEndpoint(endpoint)
29+
.setProject("console")
30+
.setCookie(cookie)
31+
.setSelfSigned(selfSigned)
32+
.setLocale("en-US");
33+
3634
return client;
3735
};
3836

@@ -58,22 +56,20 @@ export const sdkForProject = async (): Promise<Client> => {
5856
);
5957
}
6058

61-
client
62-
.setEndpoint(endpoint)
63-
.setProject(project)
64-
.setSelfSigned(selfSigned)
65-
.setLocale("en-US");
66-
6759
client.headers = {
68-
"content-type": "",
6960
"x-sdk-name": "Command Line",
7061
"x-sdk-platform": "console",
7162
"x-sdk-language": "cli",
7263
"x-sdk-version": "13.0.0-rc.2",
7364
"user-agent": `AppwriteCLI/13.0.0-rc.2 (${os.type()} ${os.version()}; ${os.arch()})`,
74-
"X-Appwrite-Response-Format": "1.8.0",
7565
};
7666

67+
client
68+
.setEndpoint(endpoint)
69+
.setProject(project)
70+
.setSelfSigned(selfSigned)
71+
.setLocale("en-US");
72+
7773
if (cookie) {
7874
return client.setCookie(cookie).setMode("admin");
7975
}

0 commit comments

Comments
 (0)