Skip to content

ppadti/JWT-Authentication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Golang Jwt Authentication Project

This project provides a simple authentication system implemented in Go (Golang), utilizing various libraries and technologies such as Fiber, GORM, CORS, MySQL, bcrypt, and JWT-Go.

Features

  • User registration
  • User login
  • User logout
  • Retrieving a list of users

Technologies Used

Fiber: A web framework for Go, known for its performance and ease of use.

GORM: An ORM library for Go, used for interacting with the MySQL database.

CORS: Cross-Origin Resource Sharing middleware to allow secure cross-origin requests.

MySQL: A popular relational database management system used for storing user data.

bcrypt: A library for hashing passwords securely.

JWT-Go: A JSON Web Token implementation for Go, used for authentication purposes.

Steps to install:

1. Clone the repository:

git clone https://github.com/ppadti/JWT-Authentication.git

cd JWT-Authentication

2. Install dependencies:

go mod tidy

Set up the MySQL database. Make sure to update the database configuration in database/connection.go

3. Run the project:

go run main.go

Endpoints

POST /api/register: Register a new user. Requires a JSON body with username, email and password fields.

POST /api/login : Login with username and password. Returns a JWT token upon successful authentication.

POST /api/logout: Logout the user. Requires a valid JWT token.

GET /api/users : Retrieve a list of users. Requires a valid JWT token.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages