Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Hapi Swagger does not support oauthOptions property into plugin configuration #745

Open
ymedaghri opened this issue May 4, 2022 · 4 comments

Comments

@ymedaghri
Copy link

Issue

Environment

npx envinfo --npmPackages '*hapi*' --binaries

(paste the output of the command here)

Steps to Reproduce

The Hapi Swagger Plugin Options does not support the property oauthOptions

{
    plugin: HapiSwagger as Plugin<unknown>,
    options: {
      jsonPath: '/products/swagger.json',
      info: {
        title: 'Product Documentation',
        version
      },
      oauthOptions:{
        oauth2RedirectUrl: "http:https://localhost:3200/someNewPage.html",
      },
      security,
      securityDefinitions,
      grouping: 'tags',
      documentationPath: '/products/documentation',
      swaggerUIPath: '/products/swaggerui/'
    }
  }

Expected Behavior

Swagger should load, and oauth2RedirectUrl be changed from default to the defined value in config.

Actual Behavior

Swagger does not load.

image

Reproducible Demo

Add the oauthOptions in the Hapi Swagger Plugin Options ( oauthOptions:{...} ).
Launch the swagger ui, the error is raises at swagger ui front screen and in the console log.

@robmcguinness
Copy link
Collaborator

Can you link to docs saying that should be supported?

@ymedaghri
Copy link
Author

Hi,
Actually, when I read the Options Reference in the github page (https://github.com/glennjones/hapi-swagger/blob/master/optionsreference.md), I found the following line :
oauthOptions: TODO
image

Indeed I'm not sure if it should be supported or not, but in my case It would be great to have this feature.
Thank you
Best Regards

@robmcguinness
Copy link
Collaborator

ok thanks. seems the docs and code have disconnect.

@glennjones
Copy link
Collaborator

From memory it was never added, mainly to keep the UI a little simpler. It should be possible to add it there is support within swagger UI and @hapi/bell. The main work will not just be wiring up the code, but enhancing the documentation to cover this subject. It is often a bit of an involved process adding OAuth and I am sure it will increase our support issues. Adding an example use case may also be a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants