Skip to content

Commit 7c8f4d9

Browse files
authored
fix(cli): prevent session cookie from being wiped
Prior to this change, the CLI would replace the cookies in the config if the server returned any cookies, even when not authenticating. This change makes it so we check for the Appwrite session cookie and only save that cookie if it's found in the response.
1 parent f1f506d commit 7c8f4d9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

templates/cli/lib/client.js.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ class Client {
171171

172172
let cookies = response.headers.getSetCookie();
173173
if (cookies && cookies.length > 0) {
174-
globalConfig.setCookie(cookies.join(";"));
174+
for (const cookie of cookies) {
175+
if (cookie.startsWith('a_session_console=')) {
176+
globalConfig.setCookie(cookie);
177+
}
178+
}
175179
}
176180

177181
const text = await response.text();

0 commit comments

Comments
 (0)