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

Admin Swagger UI not available when using api-key #567

Closed
esune opened this issue Jun 19, 2020 · 3 comments · Fixed by #570
Closed

Admin Swagger UI not available when using api-key #567

esune opened this issue Jun 19, 2020 · 3 comments · Fixed by #570

Comments

@esune
Copy link
Member

esune commented Jun 19, 2020

How to reproduce

Start an instance of aca-py using the following command:

PORTS="5000:5000 1000:1000" ./scripts/run_docker start --inbound-transport http 0.0.0.0 10000 --outbound-transport http --admin 0.0.0.0 5000 --admin-api-key my-super-secret-key --log-level DEBUG

This will start aca-py and activate its admin interface, expose it on port 5000 and protect requests targeting it using the specified api-key.

Expected result:
Navigating to http://localhost:5000 in the web browser results in the Swagger UI being displayed. Requests made through the UI will not work unless the api-key is provided (Swagger has a mechanism that allows to do so).

Actual result:
The agent returns the error message 401: unauthorized

This is an issue during development as it forces developers to start another instance of the agent just to check the Swagger docs, while it should be possible to use the currently running instance.

@msembinelli
Copy link
Contributor

I think this mainly because the swagger doc route is also protected.

I used a chrome extension called ModHeader and I was able to set the api key and view the swagger

@esune
Copy link
Member Author

esune commented Jun 19, 2020

Thanks @msembinelli, that is a good suggestion!

I personally would prefer if the doc route was unprotected in view mode, and requested an api-key could be entered in the swagger UI directly (see here as an example).

It may not be possible or easy to implement in our case though, I haven't looked into it yet - maybe @andrewwhitehead, @nrempel or @sklump can weigh in since they are more familiar with the swagger docs for aca-py.

Either way, having the workaround tracked here will be useful for future developers :)

@msembinelli
Copy link
Contributor

No problem @esune , I banged my head against the wall at this one for awhile.

I agree that adding the auth button to input the token on swagger would be a much desired change.

As for unprotecting the route, maybe this is something that can be turned on with a debug parameter (so not as to use it in production)?

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

Successfully merging a pull request may close this issue.

2 participants