When developing the API for our web application, we will use their subdomain as the "username" and generate the API key / shared secret. First, is it possible to use a subdomain as a username? I do not see the benefits of generating another key.
The various APIs seem to do one of two things:
- Use Basic HTTP Authentication with SSL
In each request, the username is set to a subdomain and the password for the API key. Since we use SSL, it should be safe from spoofing.
Known APIs: Google Checkout , Freshbooks , GitHub , Zendesk
- Create request secret with shared secret
This is usually achieved by streamlining key / value pairs and using HMAC-SHA1 with a shared secret to generate a signature. Then the signature is sent with a request and verified at the other end.
Known APIs: Google Checkout , Amazon AWS
PS: this is not a mistake, Google Checkout supports both
Edit: Just read that OAuth 2 drops signatures in favor of sending username / password over SSL.
Any opinions from anyone about what to choose: SSL vs Signature?
security authentication rest api digital-signature
Marcus Apr 01 2018-11-11T00: 00Z
source share