From aff6a06c5a63d57e84f6cac9a7b6466110316867 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sun, 7 Mar 2021 07:23:26 +1100 Subject: [PATCH] Documented the API, tweaked workflow --- .github/workflows/docker.yml | 4 ++ README.md | 79 +++++++++++++++++++++++++++++++++++- 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ee3336a..4998063 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,6 +2,10 @@ name: Publish Docker image on: release: types: [ published ] + push: + tags: + - v0.* + - v1.* jobs: push_to_registry: name: Push Docker Image to Docker Hub diff --git a/README.md b/README.md index b9d6733..f589307 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,81 @@ An API centric auth server. Uses Sequelize and mariaDB by default. -TODO: Document the API +# Setup + +TODO: Dockerize this project + +TODO: Write setup instructions, once dockerized + +# API + +``` +//DOCS: Will send a validation email to the given email address +POST /auth/signup +Content-Type: application/json + +{ + "email": "example@example.com", + "username": "example", + "password": "helloworld" +} + +//DOCS: Used for validating the email address above +GET /auth/validation?username=example&token=12345678 + +//DOCS: Login after validation +POST /auth/login +Content-Type: application/json + +{ + "email": "example@example.com", + "password": "helloworld" +} + +//Result (access token's value is your authorization key below) +{ + "accessToken": "abcde", + "refreshToken": "fghij" +} + +//DOCS: Retreives the private account data, results vary +GET /auth/account +Authorization: Bearer accessToken + +//DOCS: After this is called, the refresh route will no longer work +DELETE /auth/logout +Authorization: Bearer accessToken + +{ + "token": "refreshToken" +} + +//Replace an expired authToken pair with these values +POST /auth/token +Content-Type: application/json + +{ + "token": "refreshToken" +} + +//Result +{ + "accessToken": "abcde", + "refreshToken": "fghij" +} + +//DOCS: Update account data, input varies, but is always JSON +PATCH /auth/update +Content-Type: application/json +Authorization: Bearer accessToken + +//DOCS: Sets the timer, account will be deleted after 2 days +DELETE /auth/deletion +Authorization: Bearer accessToken +Content-Type: application/json + +{ + "password": "helloworld" +} + +```