Authentication Method
Olimi uses Bearer Token authentication for all API requests. This method is simple, secure, and widely supported across different platforms and programming languages.Generating a Bearer Token
To authenticate with the Olimi API, you must first generate a bearer token using your API key. Follow these steps to generate the token programmatically:-
Make a POST request to the
generate-tokenendpoint with your API key. Here’s the format of the request: Endpoint:{{base_url}}/api/generate-token
Method:POST
Body (JSON): - Upon successful authentication, you’ll receive a JSON response containing the bearer token.
Using the Bearer Token
Include your bearer token in theAuthorization header of each API request:
Best Practices
To ensure the security of your Olimi account and data, follow these best practices:- Keep your token secure: Never share your bearer token publicly or commit it to version control systems.
- Use environment variables: Store your bearer token in environment variables rather than hardcoding it in your application.
- Implement token rotation: Regularly generate new tokens and update your applications to use the new tokens.
- Use HTTPS: Always use HTTPS for API communications to ensure data privacy and prevent man-in-the-middle attacks.
- Minimize token exposure: Only use your bearer token in server-side code. Never use it in client-side JavaScript that runs in a user’s browser.
Error Handling
If your authentication fails, you’ll receive a401 Unauthorized HTTP status code. Common reasons for authentication failures include:
- Invalid bearer token
- Expired bearer token
- Incorrectly formatted Authorization header