diff --git a/src/authenticator.ts b/src/authenticator.ts index 921d2ec..243702c 100644 --- a/src/authenticator.ts +++ b/src/authenticator.ts @@ -267,16 +267,18 @@ export class Authenticator { */ async logout( request: Request | Session, - options: { redirectTo: string } + options: { redirectTo: string; headers?: HeadersInit } ): Promise { let session = isSession(request) ? request : await this.sessionStorage.getSession(request.headers.get("Cookie")); - throw redirect(options.redirectTo, { - headers: { - "Set-Cookie": await this.sessionStorage.destroySession(session), - }, - }); + let headers = new Headers(options.headers); + headers.append( + "Set-Cookie", + await this.sessionStorage.destroySession(session) + ); + + throw redirect(options.redirectTo, { headers }); } }