Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fiber Auth

Fiber Auth is a lightweight authentication service built with the Fiber web framework for Go.

Features

  • User registration and login
  • JWT-based authentication
  • Secure password hashing
  • Middleware for protected routes

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/fiber-auth.git
    cd fiber-auth
  2. Install dependencies:

    go mod tidy
  3. Set up database:

    • Ensure you have a PostgreSQL database running.
    • Update the database connection string in config/config.go.
    docker run --name fiber-auth -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=fiber_auth -p 5432:5432 -d postgres
  1. Run the application:
go run main.go

Usage

  • Register a new user:
POST /register
Content-Type: application/json

{
   "username": "example",
   "password": "password123"
}
  • Login:

    POST /login
    Content-Type: application/json
    
    {
       "username": "example",
       "password": "password123"
    }
  • Access protected routes: Add the Authorization: Bearer <token> header to your requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages