How it works
Getting the token
Using the token
Include the token in theAuthorization header for all requests:
Security best practices
Never expose the secretKey
Keep the secretKey only on the backend. Never include it in frontend code or public repositories.
Use environment variables
Store credentials in environment variables or secret managers (AWS Secrets Manager, Vault, etc).
Refresh before expiration
Implement logic to refresh the token before the 3600 seconds expire.
Restrict allowed IPs
In the Safefy dashboard, restrict credential usage to your server IPs.
Common errors
| Code | Error | Solution |
|---|---|---|
| 401 | Invalid credentials | Check publicKey and secretKey |
| 403 | Unauthorized IP | Add the IP in the credential settings |
| 429 | Rate limit exceeded | Wait for the time indicated in Retry-After |
Test authentication
Try the authentication endpoint in the playground.