Skip to content

Conversation

@sedx
Copy link
Contributor

@sedx sedx commented Feb 12, 2016

My application use auth by headers content.
When Swagger UI fetch source from swagger documentation path it return 401 because headers sets after call swaggerUI.load() and request for swagger documentation dosen't include auth headers.

In my version headers sets in initialize swaggerUI object and when _swaggerUI.load() _call request for fetch documantation include header

@dblock
Copy link
Member

dblock commented Feb 12, 2016

I would be OK with this change. It needs a CHANGELOG entry and the commits squashed, please.

Add missing authorizations: headers

Fix Rubocop offenses
@sedx
Copy link
Contributor Author

sedx commented Feb 15, 2016

@dblock Done

@dblock
Copy link
Member

dblock commented Feb 16, 2016

I dug this a bit more. Why is the subsequent call to window.swaggerUi.api.clientAuthorizations.add not adding the headers? It's supposed to work and I know people rely on that behavior. Is this #13?

@sedx
Copy link
Contributor Author

sedx commented Feb 17, 2016

@dblock No window.swaggerUi.api.clientAuthorizations.add works fine, but all API call in my application need auth headers X-Client and X-Secret (request swagger docs too).
Ui can't get swagger_documantation.json on page load because clientAuthorizations.add call after swaggerUi.load(), and first request has no required auth headers.

@dblock
Copy link
Member

dblock commented Feb 17, 2016

Oh I see @sedx, this is much more trivial than I thought. I'll merge this.

dblock added a commit that referenced this pull request Feb 17, 2016
Headers added before  swaggerUi.load() call.
@dblock dblock merged commit 14451f5 into ruby-grape:master Feb 17, 2016
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 this pull request may close these issues.

2 participants