{"id":25522235,"url":"https://github.com/dotnet-labs/apiauthdemo","last_synced_at":"2025-06-15T02:33:05.432Z","repository":{"id":53999536,"uuid":"278099839","full_name":"dotnet-labs/ApiAuthDemo","owner":"dotnet-labs","description":"A simple demo with JWT Auth APIs and Basic Auth APIs, with Swagger support. Swagger Security; Swagger Auth","archived":false,"fork":false,"pushed_at":"2023-12-07T19:34:40.000Z","size":1462,"stargazers_count":48,"open_issues_count":0,"forks_count":23,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T01:39:40.850Z","etag":null,"topics":["basic-authentication","dotnet","dotnet-core","dotnetcore","http","http-client","jwt","jwt-auth","jwt-authentication","jwt-token","swagger","swagger-ui"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotnet-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"changhuixu","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-07-08T13:40:52.000Z","updated_at":"2025-04-09T19:06:06.000Z","dependencies_parsed_at":"2023-12-07T20:40:01.072Z","dependency_job_id":null,"html_url":"https://github.com/dotnet-labs/ApiAuthDemo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dotnet-labs/ApiAuthDemo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet-labs%2FApiAuthDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet-labs%2FApiAuthDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet-labs%2FApiAuthDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet-labs%2FApiAuthDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotnet-labs","download_url":"https://codeload.github.com/dotnet-labs/ApiAuthDemo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotnet-labs%2FApiAuthDemo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259912545,"owners_count":22931080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["basic-authentication","dotnet","dotnet-core","dotnetcore","http","http-client","jwt","jwt-auth","jwt-authentication","jwt-token","swagger","swagger-ui"],"created_at":"2025-02-19T18:18:54.705Z","updated_at":"2025-06-15T02:33:05.406Z","avatar_url":"https://github.com/dotnet-labs.png","language":"C#","funding_links":["https://ko-fi.com/changhuixu","https://ko-fi.com/I3I63W4OK"],"categories":[],"sub_categories":[],"readme":"# JWT auth and Basic auth, Swagger UI Security Configuration\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I3I63W4OK)\n\nThis repository demos a Web API project, `ApiAuthDemo`, which is configured to use JWT authentication globally, and some action methods can be configured to use Basic Auth using an attribute. The demo website root is its Swagger user interface.\n\nThere is another Console app `BasicAuthApiConsumer`, which is a demo to consume a Basic Authentication API endpoint. The Console app needs to run after you start the `ApiAuthDemo` website, and you can adjust the URL in the Console program accordingly.\n\n## Medium Articles\n\n### [Basic Authentication](https://codeburst.io/adding-basic-authentication-to-an-asp-net-core-web-api-project-5439c4cf78ee)\n\n\u003e How to add Basic Authentication to an ASP.NET Core 3 Web API project.\n\n### [API Security in Swagger](https://codeburst.io/api-security-in-swagger-f2afff82fb8e)\n\n\u003e How to configure security schemes for our API documentation in Swagger.\n\n## Screen recordings\n\n### Screen recording for an API with Basic Authentication\n\n![Screen recording for an API with Basic Authentication](./basic-auth-edge.gif)\n\n### Screen recording for API authentication in Swagger UI\n\n![Screen recording for API authentication in Swagger UI](./swagger-auth.gif)\n\n## License\n\nFeel free to use the code in this repository as it is under MIT license.\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/I3I63W4OK)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnet-labs%2Fapiauthdemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotnet-labs%2Fapiauthdemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotnet-labs%2Fapiauthdemo/lists"}