26 lines
1.9 KiB
Markdown
26 lines
1.9 KiB
Markdown
|
# `/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. |
|