This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 164
swagger-ui #475
Comments
Hi, @wolfgangwalther, my suggestion would be to utilize nginx as proxy and a static swagger bundle host. The settings for the nginx would be something along the lines of:
While the static swagger index.html would have this addition: <script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "/api/",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
requestInterceptor: (req) => {
if (!req.loadSpec) {
// So that user doesn't have to specify Bearer in front of their token
if (req.headers.Authorization && !req.headers.Authorization.includes('Bearer')) {
req.headers.Authorization = "Bearer " + req.headers.Authorization;
}
}
return req;
}
});
window.ui = ui;
};
</script> I hope this help you, cheers! |
Also related: PostgREST/postgrest#1082 |
10 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Discussed in PostgREST/postgrest#2090
Originally posted by skrick November 18, 2021
What is the "best" way to configure swagger to work with postgrest. I have tried to use docker to link my postgrest and swagger-ui but I cannot figure out how to enable the Bearer security auth. All of my API calls require a valid jwt token.
The text was updated successfully, but these errors were encountered: