Authentication overview

Remote Calc employs a straightforward and secure authentication mechanism to control access to its API services. The core method involves the use of API keys, which serve as unique identifiers and secret tokens for authenticating client applications. This approach simplifies integration while maintaining a necessary level of security for programmatic access to features such as the Expression Evaluator and Unit Converter.

When an application makes a request to the Remote Calc API, it must include a valid API key. The API key is validated against the developer's account to ensure that the request originates from an authorized source and to enforce any associated usage limits or subscription tiers. All communications with the Remote Calc API are secured using HTTPS/TLS, encrypting data in transit and protecting API keys from interception during transmission, a standard practice for web APIs as outlined by the W3C Web Security APIs.

Remote Calc's authentication system is designed to be compatible with its various SDKs (Python, JavaScript, Ruby, Go), providing developers with pre-built methods to handle credential inclusion in requests. This streamlines the development process for integrating Remote Calc's mathematical capabilities into applications.

Supported authentication methods

Remote Calc exclusively supports API key authentication. This method is suitable for most server-to-server and backend-to-API communication patterns, offering a balance of security and ease of implementation. While other authentication methods like OAuth 2.0 or mutual TLS exist for more complex scenarios, API keys are effective for direct application-to-service authentication where the application itself holds the secret.

The API key functions as a bearer token. When included in the Authorization header of an HTTP request, it grants access to the associated account's resources. This model is common for many RESTful APIs due to its simplicity and effectiveness in controlling access at a granular level. For a broader understanding of API key usage, the Kong API Gateway documentation on API key authentication provides additional context.

The following table summarizes the authentication method supported by Remote Calc:

Method When to Use Security Level
API Key (Bearer Token) Server-to-server communication, backend applications, direct API access Moderate to High (when combined with HTTPS, secure storage, and proper rotation)

Getting your credentials

To authenticate with the Remote Calc API, you need to obtain an API key from your Remote Calc account dashboard. The process generally involves these steps:

  1. Account Creation/Login: Navigate to the Remote Calc homepage and either create a new account or log in to an existing one.
  2. Dashboard Access: Once logged in, access your developer dashboard or account settings area. The exact navigation may vary but typically involves a section labeled "API Keys," "Credentials," or "Settings."
  3. Key Generation: Within the API Key section, you will find an option to generate a new API key. Some platforms allow for multiple keys, enabling different keys for different environments (e.g., development, staging, production) or applications.
  4. Key Retrieval: Upon generation, your API key will be displayed. It is crucial to copy this key immediately and store it securely, as it may not be retrievable again for security reasons. If lost, you would typically need to generate a new key and revoke the old one.
  5. Key Management: The dashboard also provides tools for managing your API keys, including options to revoke existing keys or generate new ones. Regular key rotation is a recommended security practice.

For detailed, step-by-step instructions specific to the Remote Calc platform, refer to the official Remote Calc API Reference documentation.

Authenticated request example

Once you have obtained your API key, you can include it in your API requests. The Remote Calc API expects the API key to be passed in the Authorization header using the Bearer token scheme. Here's an example using curl, a common command-line tool for making HTTP requests:

curl -X POST \
  https://api.remotecalc.com/evaluate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "expression": "(15 * 3) / 2 + 7" }'

In this example:

  • YOUR_API_KEY should be replaced with the actual API key you obtained from your Remote Calc dashboard.
  • -H "Authorization: Bearer YOUR_API_KEY" sets the HTTP Authorization header with your API key prefixed by "Bearer ". This is the standard way to send a bearer token.
  • -H "Content-Type: application/json" indicates that the request body is in JSON format.
  • -d '{ "expression": "(15 * 3) / 2 + 7" }' provides the JSON payload for the /evaluate endpoint, containing the mathematical expression to be calculated.

The Remote Calc SDKs abstract this process, making it simpler to include credentials. For instance, in Python, an authenticated request might look like this:

import remotecalc

# Initialize the client with your API key
client = remotecalc.Client(api_key="YOUR_API_KEY")

# Make an authenticated request to evaluate an expression
result = client.evaluate(expression="(15 * 3) / 2 + 7")
print(result)

Refer to the Remote Calc API documentation for specific examples in other supported languages like JavaScript, Ruby, and Go.

Security best practices

Adhering to security best practices is essential when working with API keys to protect your applications and data. Remote Calc recommends the following:

  • Keep API Keys Confidential: Treat your API keys like passwords. Never hardcode them directly into client-side code (e.g., JavaScript in a browser) or commit them to public version control systems like GitHub. Store them in environment variables, secret management services, or secure configuration files.
  • Use Environment Variables: For server-side applications, storing API keys in environment variables is a common and recommended practice. This prevents the keys from being directly exposed in your codebase and allows for easy rotation without code changes.
  • Secure Storage: If local storage is necessary, ensure API keys are stored in encrypted files or secure vaults. For cloud deployments, leverage platform-specific secret management services (e.g., AWS Secrets Manager, Google Cloud Secret Manager, Azure Key Vault).
  • Restrict Key Permissions (if applicable): While Remote Calc API keys generally grant access to all API functions for an account, if a platform offered granular permissions, it would be best practice to create keys with the minimum necessary permissions.
  • Regular Key Rotation: Periodically rotate your API keys. This practice minimizes the window of opportunity for a compromised key to be exploited. If a key is suspected of being compromised, revoke it immediately and generate a new one.
  • Monitor API Usage: Regularly review your API usage logs for any unusual activity. Spikes in requests or calls from unexpected geographic locations could indicate a compromised key.
  • HTTPS/TLS Enforcement: Always ensure that all API requests are made over HTTPS. Remote Calc enforces HTTPS for all API endpoints, which encrypts the communication channel and protects your API key from eavesdropping during transit.
  • Implement Rate Limiting and Quotas: While Remote Calc implements its own rate limiting, it's good practice to implement client-side rate limiting where appropriate to prevent accidental overuse or to mitigate the impact of a compromised key making excessive requests.
  • Error Handling: Implement robust error handling in your application to gracefully manage authentication failures. This can include logging errors for review and preventing sensitive information from being exposed to end-users.

By following these best practices, developers can significantly enhance the security posture of their applications integrating with Remote Calc, protecting their credentials and ensuring the integrity of their API interactions.