also sending cookies on json auth requests

This commit is contained in:
dswbx
2025-02-01 09:13:42 +01:00
parent 86ba055f5e
commit db476080ad
2 changed files with 17 additions and 6 deletions

View File

@@ -15,7 +15,10 @@ export class AuthApi extends ModuleApi<AuthApiOptions> {
}
async login(strategy: string, input: any) {
const res = await this.post<AuthResponse>([strategy, "login"], input);
const res = await this.post<AuthResponse>([strategy, "login"], input, {
credentials: "include"
});
if (res.ok && res.body.token) {
await this.options.onTokenUpdate?.(res.body.token);
}
@@ -23,7 +26,10 @@ export class AuthApi extends ModuleApi<AuthApiOptions> {
}
async register(strategy: string, input: any) {
const res = await this.post<AuthResponse>([strategy, "register"], input);
const res = await this.post<AuthResponse>([strategy, "register"], input, {
credentials: "include"
});
if (res.ok && res.body.token) {
await this.options.onTokenUpdate?.(res.body.token);
}