Overview
The HGT EAM WebServices API uses HTTP Basic Authentication to secure all endpoints. Every API request must include valid credentials in theAuthorization header.
Authentication Scheme
The API implements Basic Authentication using the following components:- Realm:
EAM-Webservices - Scheme:
Basic - Encoding: Base64
How Basic Authentication Works
1. Prepare Credentials
Combine your username and password with a colon separator:2. Encode to Base64
Encode the credentials string using Base64 encoding:The
-n flag prevents adding a newline character, which would corrupt the encoding.3. Add Authorization Header
Include the encoded credentials in theAuthorization header with the Basic prefix:
Making Authenticated Requests
Using cURL
Option 1: Let cURL Handle Encoding
-u flag automatically handles Base64 encoding.
Option 2: Manual Authorization Header
Using JavaScript (Fetch API)
Using Python (Requests)
Using C# (.NET)
Using Postman
- Open your request in Postman
- Go to the Authorization tab
- Select Basic Auth from the Type dropdown
- Enter your Username and Password
- Postman will automatically encode and add the header
Credential Configuration
Credentials are configured server-side in theappsettings.json file:
Contact your system administrator to obtain valid API credentials.
Authentication Flow
When you make a request, the server performs the following validation:Handling Authentication Errors
401 Unauthorized Response
If authentication fails, you’ll receive:Common Causes
Missing Authorization Header
Missing Authorization Header
Invalid Base64 Encoding
Invalid Base64 Encoding
Problem: Credentials not properly Base64 encoded.Solution: Ensure you encode The
username:password correctly:-n flag is critical to avoid newline characters.Incorrect Username or Password
Incorrect Username or Password
Problem: Credentials don’t match configured values.Solution:
- Verify credentials with your administrator
- Check for typos in username or password
- Ensure no extra spaces in credentials
Wrong Format
Wrong Format
Problem: Using incorrect header format.Incorrect:Correct:The
Basic prefix is required.Debugging Authentication Issues
Verify Your Encoding
Test with cURL
Check Response Headers
HTTP/1.1 200 OK- Authentication successfulHTTP/1.1 401 Unauthorized- Authentication failedWWW-Authenticate: Basic realm="EAM-Webservices"- Server expects Basic Auth
Security Best Practices
Do’s
✅ Always use HTTPS - Credentials are Base64 encoded, not encrypted✅ Store credentials securely - Use environment variables or secure vaults
✅ Rotate credentials regularly - Change passwords periodically
✅ Use unique credentials - Don’t share credentials across services
✅ Monitor failed attempts - Track authentication failures
Don’ts
❌ Don’t commit credentials - Never store passwords in source code❌ Don’t use HTTP - Always use HTTPS for API requests
❌ Don’t log credentials - Exclude auth headers from logs
❌ Don’t share credentials - Each user/service should have unique credentials
❌ Don’t hardcode credentials - Use configuration or environment variables
Environment Variables
.env File (for applications)
Rate Limiting and Authentication
Rate limits are applied per authenticated user:- Authenticated users: Limited by username (60 requests/minute)
- Anonymous requests: Limited by IP address (60 requests/minute)
Testing Authentication
Here’s a quick test to verify your credentials:Next Steps
API Overview
Learn about available endpoints and response formats
Provision Endpoints
Start making requests to provision endpoints
Response Models
Understand response structure and fields
Rate Limiting
Understand rate limits and quotas