Skip to content

all-in-one authentication api for go including signup, login, forgot password, reset password, email setup and more

Notifications You must be signed in to change notification settings

Toheeb-Ojuolape/go-auth-jwt

Repository files navigation

Go-authentication using gin with JWT, ENV and PostgreSQL set up

You can easily get started with authenticating your users using signup, login, forgot password, email,verify otp, and reset password and fetch user data using this Github project. Just fork it to get started.

Setting up Hot Reload in Go

You can use go daemon to setup hot reload so you don't need to restart your project everytime you push an update:

    1. In your command line, run : go install github.com/joho/godotenv
    1. then run compiledaemon --command="./go-gin-auth" (replace go-gin-auth with the name of your own project)

Available endpoints

  • /signup - takes in email, password, username, firstName, lastName, phone (you can always add more)
  • /login - takes in email and password and returns a jwt token and user data
  • /user - fetches all the user's data from the database
  • /forgot-password - sends an otp for user to reset their password
  • /verify-otp - verify otp sent to email
  • /reset-password - enables a user to change their password
  • /google-auth - enables a user to login with google (coming soon)

Database setup

Project uses postgreSQL but you can use any database of your choice, but just make sure to follow best practice by specifying your connection string in your .env. Sample DB string for Postgres: "host=localhost user=postgres password=Password dbname=go-gin-auth port=5432 sslmode=disable"

About

all-in-one authentication api for go including signup, login, forgot password, reset password, email setup and more

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages