Service written in golang which provides a simple authentication flow.
The whole flow looks like:
- User creates a new account by providing full name, email and password
- User can sign in by using credentials given in the registration process if credentials are valid then he obtains a pair of tokens, access and refresh tokens. The first one is a short lived token and it is to validate potential user in protected endpoints. The second one is stored in the database and it is used when user want to refresh an access token. All tokens are stored in cookies and those are
httpOnly. - User can make requests to protected endpoints.
- Client side is responsible for refreshing an access token using refresh token
If you would like to run the service locally you must:
- copy
.env.templatefile by usingcp .env.template .envcommand and fill all required variables. - Run the
go run cmd/api/main.gocommand to run the API application. If you want to have a live reload then you must haveairpackage installed. After that, you can simply runaircommand.