Welcome to the Authentication API documentation. This section provides detailed information about the authentication process and the endpoints available for user authentication.
Overview
The Authentication API allows you to manage user authentication on your application. It provides endpoints for user registration, login, and token management.
Endpoints
Register User
To register a new user, you can use the /api/register
endpoint. The request should include the user's email, username, and password.
- URL:
/api/register
- Method:
POST
- Request Body:
{ "email": "user@example.com", "username": "user123", "password": "password123" }
Login User
To login a user, you can use the /api/login
endpoint. The request should include the user's email and password.
- URL:
/api/login
- Method:
POST
- Request Body:
{ "email": "user@example.com", "password": "password123" }
Token Management
Once a user is authenticated, you will receive an access token. This token can be used to make authenticated requests to other endpoints.
- URL:
/api/token
- Method:
GET
- Headers:
Authorization: Bearer <access_token>
Example
Here is an example of how to use the Authentication API to register and login a user:
# Register a new user
curl -X POST -H "Content-Type: application/json" -d '{"email": "user@example.com", "username": "user123", "password": "password123"}' http://example.com/api/register
# Login a user
curl -X POST -H "Content-Type: application/json" -d '{"email": "user@example.com", "password": "password123"}' http://example.com/api/login
# Get the access token
curl -X GET -H "Authorization: Bearer <access_token>" http://example.com/api/token
For more information about the Authentication API, please refer to our full documentation.