feat(api): defined token management endpoints

This commit is contained in:
antifallobst 2023-08-17 15:20:31 +02:00
parent ccb3b3fd36
commit ab8f145d3f
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
1 changed files with 54 additions and 1 deletions

55
API.md
View File

@ -39,6 +39,7 @@ __Content - JSON:__
##### 422 - Error: Unprocessable Entity
Malformed email address.
### `/account/verify` - POST
Verifies a requested account.
@ -62,6 +63,7 @@ Blocked for security reasons.
##### 404 - Error: Forbidden
The provided token is unknown.
### `/account/authenticate` - POST
Generates an authentication token for an account.
@ -109,6 +111,57 @@ Deletes the account.
##### 200 - Success
The account was deleted.
##### 401 - Error: Unauthorized
The provided token doesn't allow you to perform this operation.
The provided auth token doesn't allow you to perform this operation.
##### 403 - Error: Forbidden
Blocked for security reasons.
### `/account/tokens` - DELETE
Deletes a token of the authenticated account.
#### HTTP Headers
| Header | Content |
|---------------|--------------------|
| Authorization | `Bearer {token}` |
| Content-Type | `application/json` |
#### Content - JSON
| Field | Description |
|-------|-----------------------------------|
| token | The token that should be deleted. |
#### Responses
##### 200 - Success
The token was deleted.
##### 401 - Error: Unauthorized
The provided auth token doesn't allow you to perform this operation.
##### 403 - Error: Forbidden
Blocked for security reasons.
##### 404 - Error: Not Found
The token that should be deleted wasn't found.
### `/account/tokens` - GET
Lists all active auth tokens for the account.
#### HTTP Headers
| Header | Content |
|---------------|--------------------|
| Authorization | `Bearer {token}` |
| Content-Type | `application/json` |
#### Content - JSON
| Field | Description |
|-------|-----------------------------------|
| token | The token that should be deleted. |
#### Responses
##### 200 - Success
__Content - JSON:__
| Field | Description |
|--------|-------------------------------------------|
| tokens | A list of (token, expiration date) pairs. |
##### 401 - Error: Unauthorized
The provided auth token doesn't allow you to perform this operation.
##### 403 - Error: Forbidden
Blocked for security reasons.