API Authentication

Learn how to authenticate API requests using JWT tokens.

Getting Your API Token

To use ScallerFox API, you need to obtain an access token by logging in:

POST /api/auth/login

{
  "username": "your_username",
  "password": "your_password"
}

Response:
{
  "access_token": "eyJhbGciOiJIUzI1NiIs...",
  "user": { ... }
}

Store the token: Save the access_token securely. You'll need it for all authenticated API requests.

Using the Token

Include the token in the Authorization header of all API requests:

Request Header:

Authorization: Bearer eyJhbGciOiJIUzI1NiIs...
Content-Type: application/json

Example cURL:

curl -X GET https://api.scallerfox.com/api/applications \\
  -H "Authorization: Bearer YOUR_TOKEN" \\
  -H "Content-Type: application/json"

Token Expiration

Token Lifetime: Access tokens expire after a set period for security. When a token expires, you'll receive a 401 Unauthorized response.

Solution: Implement token refresh logic in your application to automatically re-authenticate when tokens expire.