https://github.com/choudharymahipal/jwtauthentication_dotnetcore
This project demonstrates how to implement JWT (JSON Web Token) authentication in a .NET Core application.
https://github.com/choudharymahipal/jwtauthentication_dotnetcore
asp-net-core authentication jwt
Last synced: about 1 year ago
JSON representation
This project demonstrates how to implement JWT (JSON Web Token) authentication in a .NET Core application.
- Host: GitHub
- URL: https://github.com/choudharymahipal/jwtauthentication_dotnetcore
- Owner: choudharymahipal
- License: mit
- Created: 2025-04-07T16:53:31.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-07T17:38:23.000Z (about 1 year ago)
- Last Synced: 2025-04-13T21:18:17.622Z (about 1 year ago)
- Topics: asp-net-core, authentication, jwt
- Language: CSS
- Homepage:
- Size: 994 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JWT Authentication in .NET Core
This project demonstrates how to implement JWT (JSON Web Token) authentication in a .NET Core application.
## Features
- User registration and login
- Secure API endpoints with JWT authentication
- Token generation and validation
- Role-based access control
## Prerequisites
- [.NET Core SDK](https://dotnet.microsoft.com/download)
- SQL Server or any compatible database
## Getting Started
1. Clone the repository:
```bash
git clone https://github.com/choudharymahipal/JWTAuthentication_DotNetCore.git
cd JWTAuthentication_DotNetCore
```
2. Update the `appsettings.json` file with your database connection string and JWT settings.
3. Apply migrations and update the database:
```bash
dotnet ef database update
```
4. Run the application:
```bash
dotnet run
```
5. Access the API at `https://localhost:5001`.
## API Endpoints
### Authentication
- **POST** `/api/auth/register` - Register a new user
- **POST** `/api/auth/login` - Authenticate and get a JWT token
### Protected Endpoints
- **GET** `/api/secure/data` - Access secure data (requires a valid token)
## Technologies Used
- .NET Core
- Entity Framework Core
- JWT Authentication
- Swagger for API documentation
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Acknowledgments
- [Microsoft Documentation](https://learn.microsoft.com/)
- [JWT.io](https://jwt.io/)