Api: rotacja refresh tokenu + limit na /auth/refresh, dokumentacja i localhost CORS tylko poza produkcja

This commit is contained in:
tisachi
2026-10-11 15:53:01 +02:00
parent 2fb288e029
commit c5c6583a2d
5 changed files with 28 additions and 12 deletions

View File

@@ -101,6 +101,10 @@ describe('auth routes', () => {
const refresh = await agent.post('/api/v1/auth/refresh');
expect(refresh.status).toBe(200);
expect(typeof refresh.body.accessToken).toBe('string');
// rotacja: każde odświeżenie wystawia nowy refresh token w cookie httpOnly
const setCookie = (refresh.headers['set-cookie'] ?? []).join('; ');
expect(setCookie).toContain('fitos_refresh=');
expect(setCookie).toContain('HttpOnly');
});
it('refresh: rejects a missing cookie with 401', async () => {