Skip to content

Commit 3d230a9

Browse files
authored
docs(security): added cookie auth section
1 parent 6cd115c commit 3d230a9

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

content/recipes/swagger.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,22 @@ Before you run your application, remember to add the security definition to your
616616
const options = new DocumentBuilder().addOAuth2();
617617
```
618618

619+
#### Cookie authentication
620+
621+
To enable cookie authentication, use `@ApiCookieAuth()`.
622+
623+
```typescript
624+
@ApiCookieAuth()
625+
@Controller('cats')
626+
export class CatsController {}
627+
```
628+
629+
Before you run your application, remember to add the security definition to your base document using `DocumentBuilder`:
630+
631+
```typescript
632+
const options = new DocumentBuilder().addCookieAuth('optional-session-id');
633+
```
634+
619635
#### File upload
620636

621637
You can enable file upload for a specific method with the `@ApiBody` decorator together with `@ApiConsumes()`. Here's a full example using the [File Upload](/techniques/file-upload) technique:

0 commit comments

Comments
 (0)