Customizing swagger-ui: Logout Action

Mathis Michel
Feb 14, 2021

--

With OpenAPI you can define so called security schemas. This section is used to define your authentication and authorization flows.

Maybe you have already noticed the Logout button within the authorize modal. If not you can find it at PetStore when clicking on the Authorize button and setting a value the logout button appears:

This button is used to clear authentication values provided by the user. We can use this to hook into and run custom logic.
For example we could use this to call a logout endpoint.
To archive this the plugin system of swagger-ui can be used to wrap the logout redux action.
The action is called with the keys of the security schemas to log out of.

swagger-ui custom logout plugin

Happy Coding!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Mathis Michel
Mathis Michel

Written by Mathis Michel

22 year old software developer.

No responses yet

Write a response