mirror of
https://github.com/AnimeThemes/animethemes-api-docs.git
synced 2026-07-11 01:34:06 +02:00
feat: add documentation for token-based authentication (#17)
This commit is contained in:
@@ -17,6 +17,10 @@ module.exports = {
|
||||
{
|
||||
title: 'Rate Limiting',
|
||||
to: '/ratelimiting'
|
||||
},
|
||||
{
|
||||
title: 'Authentication',
|
||||
to: '/authentication'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -22,6 +22,12 @@ The AnimeThemes API applies the standard named rate limiter of the Laravel Frame
|
||||
|
||||
We provide an overview of managing request quotas.
|
||||
|
||||
## [Authentication](/authentication/)
|
||||
|
||||
The AnimeThemes API uses token-based authentication to grant the user access to protected actions.
|
||||
|
||||
API tokens can be granted abilities that specify which actions can be performed.
|
||||
|
||||
## Terms of Use
|
||||
|
||||
The AnimeThemes API applies the [**AnimeThemes Terms of Service**](/terms-of-service).
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
---
|
||||
title: Authentication
|
||||
---
|
||||
|
||||
# Authentication
|
||||
|
||||
---
|
||||
|
||||
The AnimeThemes API uses token-based authentication to grant the user access to protected actions.
|
||||
|
||||
API tokens can be granted abilities that specify which actions can be performed.
|
||||
|
||||
## Managing Tokens
|
||||
|
||||
API tokens are managed from the API Tokens Screen within the AnimeThemes application.
|
||||
|
||||
### Creating Tokens
|
||||
|
||||
Log in to AnimeThemes. The Dashboard Screen will be displayed with a Navigation Bar.
|
||||
|
||||
Click the User Menu in the top-right corner of the Navigation Bar. The API Tokens Option will be displayed.
|
||||
|
||||
Select the API Tokens Option. The API Tokens Screen will be displayed.
|
||||
|
||||
On the API Tokens Screen, the Create API Token Form will be displayed.
|
||||
|
||||
On the Create API Token Form, specify a Token Name.
|
||||
|
||||
On the Create API Token Form, optionally specify Permissions. Permissions are the abilities that the token is granted.
|
||||
|
||||
On the Create API Token Form, click the Create Button. The API Token Modal will be displayed.
|
||||
|
||||
On the API Token Modal, copy and store the token.
|
||||
|
||||
On the API Token Modal, click the Close Button. The Modal will be dismissed and the token will be displayed in the Manage API Tokens Form.
|
||||
|
||||
### Updating Tokens
|
||||
|
||||
On the Manage API Tokens Form, click the Permissions Link. The API Token Permissions Modal will be displayed.
|
||||
|
||||
On the API Token Permissions Modal, specify changes to Permissions.
|
||||
|
||||
On the API Token Permissions Modal, click the Save Button. The Modal will be dismissed and the changes will be applied.
|
||||
|
||||
### Deleting Tokens
|
||||
|
||||
On the Manage API Tokens Form, click the Delete Link. The Delete API Token Modal will be displayed.
|
||||
|
||||
On the Delete API Token Modal, click the Delete Button. The Delete API Token Modal will be dismissed and the API token will be removed from the Manage API Tokens Form.
|
||||
|
||||
## Expiration
|
||||
|
||||
API Tokens are configured to expire after **one month**.
|
||||
|
||||
Expired API Tokens are automatically pruned from AnimeThemes once a day.
|
||||
@@ -23,6 +23,8 @@ X-RateLimit-Remaining: 89
|
||||
...
|
||||
```
|
||||
|
||||
## Exceeding the Rate Limit
|
||||
|
||||
If the rate limit is exceeded, the AnimeThemes API will return `Retry-After` and `X-RateLimit-Reset` headers in the response.
|
||||
|
||||
```sh
|
||||
@@ -34,6 +36,8 @@ X-RateLimit-Reset: 1625073463180
|
||||
...
|
||||
```
|
||||
|
||||
Additionally, the AnimeThemes API will return an error message in the response body.
|
||||
|
||||
```json
|
||||
{
|
||||
message: "Too Many Attempts."
|
||||
|
||||
Reference in New Issue
Block a user