-
-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Hi, I have been using this plugin. I figured it all out myself, but now I am stuck.
I just want to send a bearer token in the header within the api request. but the token is not being sent.
I have successfully logged in my Keycloak tells me that a sessions has been created.
After a little research, I found something that might be missing here. The requestInterceptor.
Maybe I'm doing this completely wrong? I'm using the password flow as it doesn't need to be that secure as it's just for testing.
Any advice would be appreciated.
<script>
window.onload = function() {
const ui = SwaggerUIBundle({
url: "http://localhost:8000/v3/api-docs",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
oauth2RedirectUrl: "http://localhost:8000/oauth2-redirect.html",
requestInterceptor: function(request) {
if (window.authorizedAccessToken) {
request.headers['Authorization'] = "Bearer " + window.authorizedAccessToken;
}
return request;
}
})
}
</script>
EDIT:
After a while I found out that Swagger does not save the token in the browser and therefore cannot be used. But how do you save the token in the browser with this plugin?
Metadata
Metadata
Assignees
Labels
No labels