Skip to content

Test Full authentication request in swagger #13

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

Closed
kamil-wisniewski opened this issue Feb 16, 2017 · 1 comment
Closed

Test Full authentication request in swagger #13

kamil-wisniewski opened this issue Feb 16, 2017 · 1 comment

Comments

@kamil-wisniewski
Copy link

Hi !
I have a problem with testing controller in swagger if access is protected. Can you explain me how I can do that's? How I can simulate loged user?

@akirasosa
Copy link
Contributor

Hi @banditeye

Thanks for trying!

https://github.com/swagger-api/swagger-ui#header-parameters
According to it, we can set custom header from browser console. For example, the example below worked for me.

swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("authorization", "Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwiZXhwIjoxNDg5MDI0NTU1fQ.wNsEseSroEja_ya_29GCrlkI0GemN5OocyQN9pQ9niMcOEqWxhynT1u9WFJDIkq4bQPbemZgUzmnPouPjPD7rw", "header"));

As a note, you have to get jwt token at first from /api/auth.

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

No branches or pull requests

2 participants