Authentication Mappings#

Auth mappings tell us how to interpret what your user provides as usable Basic Auth, Digest Auth, HTTP headers and query strings. Let's use an example where there are two auth fields available to us: account_name and api_key.

Basic Auth#

Your app might use api_key as the username and password is ignored:

{
  "username": "{{api_key}}",
  "password": "x"
}

Or maybe, where account_name is the username and api_key is the password:

{
  "username": "{{account_name}}",
  "password": "{{api_key}}"
}

Which will automatically create and use a header like:

Authorization: Basic WkFQSUVSIExPVkVTIFlPVTpYT1hP

Digest Auth#

Your app might have account_name as the username and api_key as the password:

{
  "username": "{{account_name}}",
  "password": "{{api_key}}"
}

We handle the computation of the response, so you don't have to think about realms, nonces, or qop's.

API Key Header Auth#

Say your app has two headers called X-Account-Name and X-API-Key:

{
  "X-Account-Name": "{{account_name}}",
  "X-API-Key": "{{api_key}}"
}

Which will automatically create and use headers like:

X-Account-Name: myfancyaccount
X-API-Key: 0123456789

API Key Query strings#

If your app uses an API key passed as a parameter in the query string, let's call it user_key:

{
  "user_key": "{{api_key}}"
}

Which will append ?user_key=0123456789 to the end of a URL.

↑ Was this documentation useful? Yes No
Get Help