Authentication overview
Passwordinator primarily uses API key authentication to secure access to its services, including the Password Generation API, Password Strength Checker API, and Breached Password Checker API. This method involves transmitting a unique, secret key with each request to verify the client's identity and authorize access to specific API endpoints. The API key acts as a bearer token, granting permissions associated with your account and subscription plan. All communication with the Passwordinator API must occur over HTTPS/TLS to protect the API key and request data from interception during transit. This ensures that your API interactions are encrypted and secure from eavesdropping or tampering.
The system is designed for straightforward integration, supporting various programming languages through official SDKs. These SDKs abstract away the low-level HTTP request details, including the secure handling of API keys, allowing developers to focus on integrating password management features into their applications. For instance, the Node.js SDK automatically includes the API key in the appropriate header for outgoing requests once configured. The comprehensive Passwordinator API reference provides detailed information on all available endpoints and expected request formats.
Supported authentication methods
Passwordinator supports a single, consistent authentication method across all its APIs to simplify integration and maintain a clear security model.
| Method | When to Use | Security Level |
|---|---|---|
| API Key (Header) | Primary method for all server-side and trusted client applications. Ideal for microservices, backend applications, and development environments. | High (when combined with HTTPS and proper key management) |
API keys are generally suitable for identifying the calling application rather than individual users. For applications that require user-specific authentication, such as web or mobile applications where end-users interact directly, it is recommended to proxy Passwordinator API calls through your own backend server. This backend server can then manage its own API key securely, preventing exposure on the client side. This approach aligns with broader API security recommendations for handling sensitive credentials outlined in API key policies, which advise against embedding API keys directly in client-side code.
Getting your credentials
To obtain your Passwordinator API key:
- Sign Up/Log In: Navigate to the Passwordinator homepage and either sign up for a new account or log in to an existing one. A free Developer Plan is available for up to 5,000 requests per month, which includes API key access.
- Access Dashboard: Once logged in, you will be redirected to your personal dashboard.
- Locate API Keys Section: Within the dashboard, look for a section specifically labeled "API Keys" or "Developer Settings."
- Generate Key: If you don't have an existing key, there will be an option to "Generate New Key" or "Reveal Key." Click this option to display your unique API key.
- Copy and Store: Copy the generated API key immediately and store it in a secure location. It is crucial to treat this key as sensitive information, similar to a password. Do not hardcode it directly into your application's source code, especially for public repositories. Environment variables or secure configuration management systems are preferred.
Your API key is associated with your account's subscription plan, which determines the rate limits and available features. If you upgrade your plan (e.g., from the free Developer Plan to the Basic Plan), your existing API key will automatically inherit the increased limits without requiring a new key generation.
Authenticated request example
Passwordinator expects the API key to be sent in the Authorization HTTP header, using the Bearer scheme. Here's how to structure an authenticated request using cURL and illustrate with a Python SDK example.
cURL Example
To generate a strong password using the Passwordinator API:
curl -X POST \
https://api.passwordinator.com/generate \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-d '{
"length": 16,
"uppercase": true,
"numbers": true,
"symbols": true
}'
Replace YOUR_API_KEY with your actual API key obtained from the Passwordinator dashboard. The -H 'Authorization: Bearer YOUR_API_KEY' part is where your API key is transmitted.
Python SDK Example
Using the official Passwordinator Python SDK simplifies this process:
from passwordinator import Passwordinator
import os
# It's recommended to store your API key in an environment variable
api_key = os.environ.get("PASSWORDINATOR_API_KEY")
if not api_key:
raise ValueError("PASSWORDINATOR_API_KEY environment variable not set.")
passwordinator_client = Passwordinator(api_key=api_key)
try:
# Generate a password
password_options = {
"length": 16,
"uppercase": True,
"numbers": True,
"symbols": True
}
generated_password = passwordinator_client.generate_password(**password_options)
print(f"Generated Password: {generated_password['password']}")
# Check password strength
strength_result = passwordinator_client.check_strength(password="MyS3cretP@ssw0rd!")
print(f"Password Strength Score: {strength_result['score']}")
print(f"Suggestions: {', '.join(strength_result['suggestions'])}")
except Exception as e:
print(f"An error occurred: {e}")
In this Python example, the Passwordinator client constructor takes the API key directly. The SDK then handles placing it correctly in the Authorization header for every subsequent API call. This abstraction is a significant benefit of using the provided SDKs, reducing the chance of implementation errors related to authentication.
Security best practices
Adhering to security best practices is essential when integrating any API, especially one dealing with password-related functionalities. For Passwordinator, these practices ensure the confidentiality and integrity of your API key and the data exchanged.
- Secure API Key Storage: Never hardcode your API key directly into your application's source code. Store it in environment variables, a secrets management service (e.g., AWS Secrets Manager, Azure Key Vault, Google Secret Manager), or a secure configuration file that is not committed to version control. This prevents accidental exposure and allows for easier key rotation.
-
HTTPS/TLS Enforcement: Passwordinator enforces HTTPS for all API interactions. Always ensure your client applications are configured to use
https://for API endpoints. This encrypts data in transit, protecting your API key and any sensitive information from interception by malicious actors. The Transport Layer Security (TLS) protocol is critical for secure internet communications. - Server-Side API Calls: For frontend-heavy applications (web or mobile), make API calls to Passwordinator from your backend server. Your backend server can securely store and use the API key, then proxy the results to the client application. This prevents the API key from being exposed in client-side code, where it could be extracted by attackers.
- Least Privilege: While Passwordinator's API keys currently grant access to all available functionalities, adhere to the principle of least privilege in your overall system architecture. Ensure that the service or application using the Passwordinator API key has only the necessary permissions required for its function. If further granularity becomes available from Passwordinator in the future, apply it.
- API Key Rotation: Regularly rotate your API keys. If an API key is compromised, rotating it minimizes the window of exposure. Passwordinator's dashboard provides mechanisms to generate new keys and revoke old ones. Establish a schedule for key rotation as part of your security policy, e.g., quarterly or biannually.
- Error Handling and Logging: Implement robust error handling for API requests. Avoid logging API keys or other sensitive information in plain text within application logs. Log only necessary details for debugging, such as request IDs or non-sensitive error messages. Ensure your logging system is also secure against unauthorized access.
- Monitor API Usage: Regularly monitor your API usage through the Passwordinator dashboard. Unusual spikes in requests or calls from unexpected locations could indicate a compromised API key. Set up alerts if the dashboard offers such functionality to proactively detect potential issues.
- Rate Limiting (Client-side): While Passwordinator implements server-side rate limiting, consider implementing client-side rate limiting or caching where appropriate. This can help prevent your application from hitting usage limits unnecessarily and adds a layer of resilience against denial-of-service attempts that might exploit your API key.
- SDK Usage: Whenever possible, use the official Passwordinator SDKs (Python, Node.js, Go, Ruby). These SDKs are designed to handle authentication and other API interaction details securely and efficiently, reducing the risk of common implementation errors. Refer to the Passwordinator documentation for specific SDK integration guides.