Skip to content

Danbaba1/WebAPIKeyAuth

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

WebAPIKeyAuth

A simple implementation of API Key authentication middleware in ASP.NET Core.
Useful for securing minimal APIs or internal endpoints with a shared key.

πŸ” Features

  • Lightweight API key authentication middleware
  • Easy to configure with minimal changes
  • Suitable for internal tools, microservices, or prototyping

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/ejimeoghenefejiro/WebAPIKeyAuth.git
cd WebAPIKeyAuth
  1. Configure the API Key Set the expected API key in appsettings.json:
{
  "ApiKey": "your-secure-api-key"
}
  1. Use the Middleware Register the middleware in your Program.cs or Startup.cs:
app.UseMiddleware<ApiKeyMiddleware>();

Example Request

GET /weatherforecast HTTP/1.1
Host: localhost:5000
X-API-KEY: your-secure-api-key

Running the Project

dotnet run

🀝 Contributing

Contributions and stars are welcome! ⭐ Feel free to fork the repo and submit a pull request.

About

Simple implementation of API keys for authorization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 98.5%
  • ASP.NET 1.5%