This project is a user authentication API built using C# with .NET 7, Dapper as the persistence client, and SQLite as the database. It provides endpoints to register users and authenticate them, using Swagger for endpoint testing.
- Language: C#
- Framework:.NET v7/SDK 7
- Database: SQLite v3
- Persistence Client: Dapper
- Payloads: Payloads: LoginRequestModel and RegisterRequestModel
- .NET 7 SDK
- SQLite
- Clone the repository.
git clone https://github.com/your-username/user-authentication-api.git
- Navigate to the project directory:
- Build and run the project
dotnet build
&dotnet run
- Access Swagger UI by navigating to http://localhost:/swagger in your web browser.
- Register a user by providing the following information:
- First name
- Last name
- Username
- Password
- Use the registered username and password to log in.
- The API will verify the credentials against the database and return a "Login Successful!" message in the console.
Register a new user.
Request Body(RegisterRequestModel
):
{
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"username": "johndoe",
"password": "secretpassword"
}
Authenticate an existing user.
Request Body(LoginRequestModel
):
{
"username": "johndoe",
"password": "secretpassword"
}