diff --git a/docs/api/endpoints/account/auth.md b/docs/api/endpoints/account/auth.md new file mode 100644 index 0000000..96cec97 --- /dev/null +++ b/docs/api/endpoints/account/auth.md @@ -0,0 +1,25 @@ +# `/account/auth` + +**Type:** POST +**Auth:** No +**Body:** JSON + +## Description + +This endpoint generates a bearer auth token, which can then be used to access endpoints, that need auth. +The generated token expires after 2 weeks. + +## Request Body + +| Field | Description | +|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `userid` | The users primary id (the one that is returned from [`/account/register`](https://git.nerdcult.net/antifallobst/icrc-server/src/branch/master/docs/api/endpoints/account/register.md) | +| `password` | The password of the account. | + +## Responses + +| HTTP Code | Type | Description | Body | +|-----------|-----------------------------|-------------------------------------------------------------------|------------------------------------------------------------------| +| 200 | Success | Successful authentication. | Json containing only a `token` field, containing a bearer token. | +| 401 | Error/AuthenticationFailure | There was no authentication possible using the given credentials. | Standard Error Body. | +| 404 | Error/UserNotFound | There was no user found for the given ID. | Standard Error Body. | diff --git a/docs/api/endpoints/account/register.md b/docs/api/endpoints/account/register.md index 8f121ba..e5a7c23 100644 --- a/docs/api/endpoints/account/register.md +++ b/docs/api/endpoints/account/register.md @@ -1,7 +1,7 @@ # `/account/register` **Type:** POST -**Auth:** Yes +**Auth:** No **Body:** JSON ## Description