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

How do you add Basic Authentication to your swagger documentation page? #536

Closed
milesdavis16 opened this Issue Nov 16, 2017 · 4 comments

Comments

Projects
None yet
5 participants
@milesdavis16

milesdavis16 commented Nov 16, 2017

version using: 1.1.0

With Swashbuckle, how do you add basic authentication to your swagger documentation page?
How do you update the ui to accept username and password? (like attached pic)

swagger-basicauth

@wdspider

This comment has been minimized.

Show comment
Hide comment
@wdspider

wdspider Jan 4, 2018

I believe you follow the steps listed in the docs here:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore#swashbuckleaspnetcoreswaggergen but instead of using the OAuth2Scheme class, you would use the BasicAuthScheme class

wdspider commented Jan 4, 2018

I believe you follow the steps listed in the docs here:
https://github.com/domaindrivendev/Swashbuckle.AspNetCore#swashbuckleaspnetcoreswaggergen but instead of using the OAuth2Scheme class, you would use the BasicAuthScheme class

@milesdavis16

This comment has been minimized.

Show comment
Hide comment
@milesdavis16

milesdavis16 Feb 9, 2018

Thanks @wdspider!
For my particular needs I went with ApiKeyScheme:
services.AddSwaggerGen(c =>
{
...
c.AddSecurityDefinition("Bearer", new ApiKeyScheme() { In = "header", Description = "Please insert JWT with Bearer into field", Name = "Authorization", Type = "apiKey" });
});

image

image

milesdavis16 commented Feb 9, 2018

Thanks @wdspider!
For my particular needs I went with ApiKeyScheme:
services.AddSwaggerGen(c =>
{
...
c.AddSecurityDefinition("Bearer", new ApiKeyScheme() { In = "header", Description = "Please insert JWT with Bearer into field", Name = "Authorization", Type = "apiKey" });
});

image

image

@janmohammadi

This comment has been minimized.

Show comment
Hide comment
@janmohammadi

janmohammadi Apr 23, 2018

Hi
I have a little authorization tool for Swashbuckle and Bearer token.
https://github.com/janmohammadi/swashbuckle-authorize

How it works

janmohammadi commented Apr 23, 2018

Hi
I have a little authorization tool for Swashbuckle and Bearer token.
https://github.com/janmohammadi/swashbuckle-authorize

How it works

@alextof

This comment has been minimized.

Show comment
Hide comment
@alextof

alextof Aug 10, 2018

Thank you very much!

alextof commented Aug 10, 2018

Thank you very much!

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