Skip to content

Commit fc03ab0

Browse files
Merge pull request #1131 from rafaelkallis/patch-1
OpenAPI 3 Cookie Authentication Support
2 parents 5f92b92 + 3d230a9 commit fc03ab0

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
@@ -707,6 +707,22 @@ Before you run your application, remember to add the security definition to your
707707
const options = new DocumentBuilder().addOAuth2();
708708
```
709709

710+
#### Cookie authentication
711+
712+
To enable cookie authentication, use `@ApiCookieAuth()`.
713+
714+
```typescript
715+
@ApiCookieAuth()
716+
@Controller('cats')
717+
export class CatsController {}
718+
```
719+
720+
Before you run your application, remember to add the security definition to your base document using `DocumentBuilder`:
721+
722+
```typescript
723+
const options = new DocumentBuilder().addCookieAuth('optional-session-id');
724+
```
725+
710726
#### File upload
711727

712728
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)