Global

Methods

android(androidApps) → {ExpressMiddleware}

Accept requests from Android apps with given list.

Source:
Parameters:
Name Type Description
androidApps Array.<AndroidApp>

List of Android apps.

Returns:
Type:
ExpressMiddleware

middleware

ios(bundleIdentifiers) → {ExpressMiddleware}

Accept requests from iOS apps with given list.

Source:
Parameters:
Name Type Description
bundleIdentifiers Array

List of iOS bundle identifiers.

Returns:
Type:
ExpressMiddleware

middleware

ip(ipAddresses, options) → {ExpressMiddleware}

Accept requests from server IP addresses (web servers, cron jobs, etc.).

Source:
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

Name Type Attributes Default Description
behindProxy boolean <optional>
false

Is this app running over a proxy?, like NGINX? Don't forget to bind client IP address to x-forwarded-for as header in proxy server.

Returns:
Type:
ExpressMiddleware

middleware

website(httpReferrers) → {ExpressMiddleware}

Accept requests from specified HTTP referrers (web sites).

Source:
Parameters:
Name Type Description
httpReferrers Array.<HTTPReferrer>

List of HTTP referrers, like .example.com/.

Returns:
Type:
ExpressMiddleware

middleware

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

Source:
Type:
  • object

CertificateFingerprint

You can restrict an APP to specific Android applications by providing a debug certificate fingerprint or a release certificate fingerprint

Source:
Type:
  • string

ExpressMiddleware(req, res, next)

An Express middleware.

Source:
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.

Source:
Type:
  • string

IpAddress

IPv4 or IPv6 or a subnet using CIDR notation (e.g. 192.168.0.0/22).

Source:
Type:
  • string