taskcafe/api
2020-07-04 18:02:57 -05:00
..
cmd cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
conf cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
data cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
internal cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
migrations cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
scripts initial commit 2020-04-09 21:40:22 -05:00
templates/mail/user cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
uploads feature: various additions 2020-06-12 17:21:58 -05:00
docker-compose.yml cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
go.mod cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
go.sum cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
gqlgen.yml cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
magefile.go cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
Makefile cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
Pipfile initial commit 2020-04-09 21:40:22 -05:00
README.md initial commit 2020-04-09 21:40:22 -05:00
sqlc.yaml cleanup: refactor api architecture & add user roles 2020-07-04 18:02:57 -05:00
trello.json feature: add checklist 2020-06-18 18:12:15 -05:00

Authentication

Uses a refresh_token and access_token system.

The refresh_token is an opaque UUID based token. The access_token is a JWT token containing several claims such as sub & roles

The refresh_token is stored in a database and is long lived (24 hours). It is sent to the client as a cookie set to be HttpOnly.

The access_token is not stored in the database & is only stored in memory on the client side. It is short lived (5 minutes).

The access_token is used to authenticate all endpoints except endpoints under /auth

The access_token is refreshed using the refresh_token through the /auth/refresh_token endpoint. This endpoint takes in the refresh_token set VIA a cookie header & returns a new refresh_token & access_token if the refresh_token is still valid. The old refresh_token is invalidated.