This is a plugin for Swagger UI that integrates the logout process with Keycloak.
When the user clicks "Logout" the logout page of Keycloak is called and then the user session is removed from Keycloak. To use this plugin you need to include the keycloak-logout.js
file in dist/index.html
and place oauth2-logout.html
in the dist folder.
The logout URL is taken from the authorizationUrl
removing the auth
string and replacing it with the logout
string.
Rember to add OAuthLogoutPlugin
to the plugins section of SwaggerUi configuration:
const ui = SwaggerUIBundle({
...
plugins: [ OAuthLogoutPlugin ],
...
});
The oauth2-logout.html
file is needed only for closing the opened popup. We can't use the default oauth2-redirect.html
since it performs some controls that don't work after logout.