Skip to content

A microservice to manage authentication inside a application

License

Notifications You must be signed in to change notification settings

ArnoldPMolenaar/api-auth

Repository files navigation

Authentication API

Go Version Fiber Version GORM

This is an Authentication API built with Go and Fiber. It supports user sign-in, session refreshing, password reset, email verification, and user CRUD operations. The API is designed to be cross-platform using Docker.

🚀 Features

  • Sign-In: Authenticate users with username and password.
  • 🔄 Session Refresh: Refresh user sessions with refresh tokens.
  • 🔒 Password Reset: Reset user passwords securely.
  • 📧 Email Verification: Verify user email addresses.
  • 🛠️ User CRUD: Create, read, update, and delete user information.

Getting Started

Prerequisites

  • Docker
  • Docker Compose

🛠️ Installation

  1. Clone the repository:

    git clone https://github.com/ArnoldPMolenaar/api-auth.git
    cd api-auth
  2. Build and run the Docker containers:

    docker-compose up dev --build
  3. The API will be available at http://localhost:5001.

🧑‍💻 API Endpoints

User Authentication

  • Sign-Up: POST /v1/sign-up

    • Register a new user.
    • Request body: { "username": "user", "email": "[email protected]", "password": "password" }
  • Sign-In: POST /v1/username-password/sign-in

    • Authenticate a user with username and password.
    • Request body: { "username": "user", "password": "password" }
  • Refresh Token: POST /v1/refresh-token

    • Refresh the user session with a refresh token.
    • Request body: { "refresh_token": "token" }

Password Management

  • Password Reset: POST /v1/token/password

Email Verification

  • Verify Email: POST /v1/verify-email
    • Verify the user's email address.
    • Request body: { "user_id": 1, "email": "[email protected]" }

User Management

  • Get User Recipes: GET /v1/user/recipes

    • Get recipes associated with the user.
    • Request parameters: username
  • Update User: PUT /v1/user

    • Update user information.
    • Request body: { "username": "newuser", "email": "[email protected]", "phone_number": "1234567890" }
  • Delete User: DELETE /v1/user

    • Delete a user.
    • Request parameters: user_id

🤝 Contributing

Contributions are welcome! Please open an issue or submit a pull request.

📝 License

This project is licensed under the MIT License.

📞 Contact

For any questions or support, please contact [email protected].


Made with ❤️ by Arnold Molenaar

About

A microservice to manage authentication inside a application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages