diff --git a/docs/classes/http_auth0_next_response.default.html b/docs/classes/http_auth0_next_response.default.html index f9566cc51..0773f6edb 100644 --- a/docs/classes/http_auth0_next_response.default.html +++ b/docs/classes/http_auth0_next_response.default.html @@ -1,7 +1,7 @@ -default | @auth0/nextjs-auth0

Hierarchy

  • default<NextResponse>
    • default

Constructors

constructor +default | @auth0/nextjs-auth0

Hierarchy

  • default<NextResponse>
    • default

Constructors

Methods

  • Parameters

    • name: string
    • Optional options: CookieSerializeOptions

    Returns void

  • Parameters

    • location: string
    • status: number = 302

    Returns void

  • Parameters

    • name: string
    • value: string
    • Optional options: CookieSerializeOptions

    Returns void

\ No newline at end of file +

Constructors

Methods

  • Parameters

    • name: string
    • Optional options: CookieSerializeOptions

    Returns void

  • Parameters

    • location: string
    • status: number = 302

    Returns void

  • Parameters

    • name: string
    • value: string
    • Optional options: CookieSerializeOptions

    Returns void

\ No newline at end of file diff --git a/src/auth0-session/handlers/backchannel-logout.ts b/src/auth0-session/handlers/backchannel-logout.ts index 873cc826b..4450f075e 100644 --- a/src/auth0-session/handlers/backchannel-logout.ts +++ b/src/auth0-session/handlers/backchannel-logout.ts @@ -59,7 +59,7 @@ export default function backchannelLogoutHandlerFactory( } catch (e) { throw new BackchannelLogoutError('application_error', e.message); } - res.send204(); + res.sendEmpty200(); }; } diff --git a/src/auth0-session/http/auth0-response.ts b/src/auth0-session/http/auth0-response.ts index 1f3991447..44ac0d0cf 100644 --- a/src/auth0-session/http/auth0-response.ts +++ b/src/auth0-session/http/auth0-response.ts @@ -7,7 +7,7 @@ export default abstract class Auth0Response extends Auth0ResponseCook public abstract redirect(location: string, status?: number): void; - public abstract send204(): void; + public abstract sendEmpty200(): void; public abstract setHeader(name: string, value: string): void; } diff --git a/src/auth0-session/http/node-response.ts b/src/auth0-session/http/node-response.ts index 0f36f0ec8..ede409bf4 100644 --- a/src/auth0-session/http/node-response.ts +++ b/src/auth0-session/http/node-response.ts @@ -31,8 +31,8 @@ export default class NodeResponse ext this.res.end(htmlSafe(location)); } - public send204(): void { - this.res.statusCode = 204; + public sendEmpty200(): void { + this.res.statusCode = 200; this.res.end(); } diff --git a/src/http/auth0-next-response.ts b/src/http/auth0-next-response.ts index 77647d14a..2fa19db4e 100644 --- a/src/http/auth0-next-response.ts +++ b/src/http/auth0-next-response.ts @@ -32,9 +32,9 @@ export default class Auth0NextResponse extends Auth0Response { this.res.headers.set(name, value); } - public send204() { + public sendEmpty200() { const oldRes = this.res; - this.res = new NextResponse(null, { status: 204 }); + this.res = new NextResponse(null, { status: 200 }); oldRes.headers.forEach((value, key) => { this.res.headers.set(key, value); }); diff --git a/tests/auth0-session/handlers/backchannel-logout.test.ts b/tests/auth0-session/handlers/backchannel-logout.test.ts index 4269f878d..76c224330 100644 --- a/tests/auth0-session/handlers/backchannel-logout.test.ts +++ b/tests/auth0-session/handlers/backchannel-logout.test.ts @@ -28,7 +28,7 @@ describe('backchannel-logout', () => { }, data: {} }); - expect(res.statusCode).toEqual(204); + expect(res.statusCode).toEqual(200); await expect(isLoggedOut({ sid: 'foo' }, getConfig({ baseURL, ...params }))).resolves.toEqual(true); }); @@ -46,7 +46,7 @@ describe('backchannel-logout', () => { await expect(store.get('sub|__test_client_id__|bar')).resolves.toMatchObject({ data: {} }); - expect(res.statusCode).toEqual(204); + expect(res.statusCode).toEqual(200); await expect(isLoggedOut({ sid: 'foo' }, getConfig({ baseURL, ...params }))).resolves.toEqual(true); await expect(isLoggedOut({ sub: 'bar' }, getConfig({ baseURL, ...params }))).resolves.toEqual(true); await expect(isLoggedOut({ sid: 'foo', sub: 'bar' }, getConfig({ baseURL, ...params }))).resolves.toEqual(true); @@ -64,7 +64,7 @@ describe('backchannel-logout', () => { await expect(store.get('sub|__test_client_id__|bar')).resolves.toMatchObject({ data: {} }); - expect(res.statusCode).toEqual(204); + expect(res.statusCode).toEqual(200); await expect(isLoggedOut({ sub: 'bar' }, getConfig({ baseURL, ...params }))).resolves.toEqual(true); }); @@ -97,7 +97,7 @@ describe('backchannel-logout', () => { }, data: {} }); - expect(res.statusCode).toEqual(204); + expect(res.statusCode).toEqual(200); }); it('should delete a sub entry from the logout store', async () => { diff --git a/tests/handlers/backchannel-logout-page-router.test.ts b/tests/handlers/backchannel-logout-page-router.test.ts index b71cae6c7..51e021133 100644 --- a/tests/handlers/backchannel-logout-page-router.test.ts +++ b/tests/handlers/backchannel-logout-page-router.test.ts @@ -45,7 +45,7 @@ describe('backchannel-logout handler (page router)', () => { await expect( post(baseUrl, '/api/auth/backchannel-logout', { fullResponse: true, body: `logout_token=${logoutToken}` }) - ).resolves.toMatchObject({ res: { statusCode: 204 } }); + ).resolves.toMatchObject({ res: { statusCode: 200 } }); }); test('should save tokens into the store when a valid logout token is provided', async () => { @@ -57,7 +57,7 @@ describe('backchannel-logout handler (page router)', () => { fullResponse: true, body: `logout_token=${logoutToken}` }); - expect(res.statusCode).toBe(204); + expect(res.statusCode).toBe(200); expect(res.headers['cache-control']).toBe('no-store'); await expect(store.get('sid|__test_client_id__|foo')).resolves.toMatchObject({ data: {} }); await expect(store.get('sub|__test_client_id__|bar')).resolves.toMatchObject({ data: {} }); diff --git a/tests/handlers/backchannel-logout.test.ts b/tests/handlers/backchannel-logout.test.ts index e19f84e32..2ae64baf4 100644 --- a/tests/handlers/backchannel-logout.test.ts +++ b/tests/handlers/backchannel-logout.test.ts @@ -59,7 +59,7 @@ describe('backchannel-logout handler (app router)', () => { url: '/api/auth/backchannel-logout', reqInit: { method: 'post', body: `logout_token=${logoutToken}` } }); - expect(res.status).toBe(204); + expect(res.status).toBe(200); expect(res.headers.get('cache-control')).toBe('no-store'); }); @@ -86,7 +86,7 @@ describe('backchannel-logout handler (app router)', () => { url: '/api/auth/backchannel-logout', reqInit: { method: 'post', body: `logout_token=${logoutToken}` } }) - ).resolves.toMatchObject({ status: 204 }); + ).resolves.toMatchObject({ status: 200 }); await expect(store.get('sid|__test_client_id__|foo')).resolves.toMatchObject({ data: {} }); await expect(store.get('sub|__test_client_id__|bar')).resolves.toMatchObject({ data: {} }); });