Methods
android(androidApps) → {ExpressMiddleware}
Accept requests from Android apps with given list.
Parameters:
Name | Type | Description |
---|---|---|
androidApps |
Array.<AndroidApp>
|
List of Android apps. |
ios(bundleIdentifiers) → {ExpressMiddleware}
Accept requests from iOS apps with given list.
Parameters:
Name | Type | Description |
---|---|---|
bundleIdentifiers |
Array
|
List of iOS bundle identifiers. |
ip(ipAddresses, options) → {ExpressMiddleware}
Accept requests from server IP addresses (web servers, cron jobs, etc.).
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
ipAddresses |
Array.<IpAddress>
|
List of IP addresses, example: 192.168.0.1, 172.16.0.0/12, 2001:db8::1 or 2001:db8::/64. |
||||||||||
options |
object
|
Specialize the middleware
|
website(httpReferrers) → {ExpressMiddleware}
Accept requests from specified HTTP referrers (web sites).
Parameters:
Name | Type | Description |
---|---|---|
httpReferrers |
Array.<HTTPReferrer>
|
List of HTTP referrers, like .example.com/. |
Type Definitions
AndroidApp
Properties:
Name | Type | Description |
---|---|---|
packageName |
string
|
Android package name from your AndroidManifest.xml file, like com.mydomain.app |
signature |
CertificateFingerprint
|
SHA-1 signing-certificate fingerprint, lower-case and without : sign, like d30dac129121e16967719b6291afa16675445d75 |
Type:
-
object
CertificateFingerprint
You can restrict an APP to specific Android applications by providing a debug certificate fingerprint or a release certificate fingerprint
Type:
-
string
ExpressMiddleware(req, res, next)
An Express middleware.
Parameters:
Name | Type | Description |
---|---|---|
req |
object
|
Express request object |
res |
object
|
Express response object |
next |
function
|
Express next middleware function |
HTTPReferrer
How do I restrict my APP key to specific websites?
Use an HTTP referrer to restrict the URLs that can use an APP. Here are some examples of URLs that you can allow to set up a referrer:
- A specific URL with an exact path: www.example.com/path
- Any URL in a single domain with no subdomains, using a wildcard asterisk (): example.com/
- Any URL in a single subdomain, using a wildcard asterisk (): sub.example.com/
- Any subdomain or path URLs in a single domain, using wildcard asterisks (*): .example.com/
- A URL with a non-standard port: www.example.com:8000/*
Note: query parameters and fragments are not currently supported; they will be ignored if you include them in an HTTP referrer.
Type:
-
string